Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-03

warning: link.res contains output sections; did you forget -T?

7 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Juha Manninen

Yes, I know this warning can be ignored, and every active member of this list knows it, too.
However new users don't know it. Everybody who tries FPC / Lazarus for the first time will scratch their heads and use Google, trying to find out where exactly they forgot to put this "-T".

My workmate decided to try Lazarus after I had advertised it. This was the first thing that he, too, noticed and reported to me. Yes, Google gives links like:
http://www.lazarus.freepascal.org/index.php?topic=13500.0 which finally clarify the situation.
Still, is there really no way to get rid of this warning? I understand it comes from "ld". Is patching "ld" the only way?

Regards,
Juha

P.S.
The big executable size was the second thing he noticed but that is another issue. We can improve that later with default buid modes in Lazarus.

Reply by email

Sven Barth
to Juha Manninen
Juha Manninen wrote 13 lines
Yes, I know this warning can be ignored, and every active member of this list knows it, too. However new users don't know it. Everybody who tries FPC / Lazarus for the first time will scratch their heads and use Google, trying to find out where exactly they forgot to put this "-T". My workmate decided to try Lazarus after I had advertised it. This was the first thing that he, too, noticed and reported to me. Yes, Google gives links like: http://www.lazarus.freepascal.org/index.php?topic=13500.0 which finally clarify the situation. Still, is there really no way to get rid of this warning? I understand it comes from "ld". Is patching "ld" the only way?

No, this can't be changed without patching ld. Though you could try the new internal ELF linker on systems that already support it (AFAIK i386, x86_64 and MIPS (and maybe also ARM)), but I don't know whether it already supports all features (like building shared libraries).

Regards,
Sven

Reply by email

Mattias Gaertner
to Juha Manninen: Yes, I know this warning can be ignored, and every active member of this list knows it,…
Show quoted text 13 lines
Yes, I know this warning can be ignored, and every active member of this list knows it, too. However new users don't know it. Everybody who tries FPC / Lazarus for the first time will scratch their heads and use Google, trying to find out where exactly they forgot to put this "-T". My workmate decided to try Lazarus after I had advertised it. This was the first thing that he, too, noticed and reported to me. Yes, Google gives links like: http://www.lazarus.freepascal.org/index.php?topic=13500.0 which finally clarify the situation. Still, is there really no way to get rid of this warning? I understand it comes from "ld". Is patching "ld" the only way?

Patching?
The error is simple: can not find the library. ld can not tell much more, except maybe where it has searched, and what .o file or link.res has asked for the library.
Maybe a quickfix item can be added to extend the message with that information. Just like the IDE is doing for "can not find unit" messages.
It can not give the information how to install the needed library, because there are too many possibilities. Maybe a link to a page about linker errors with some explanations and examples can be given.
Or the lpk could provide a fpdoc topic about link errors and the IDE could automatically show that.

Mattias

Reply by email

Victor Matuzenko
to Sven Barth: No, this can't be changed without patching ld. Though you could try the new internal ELF…

04.03.2013 16:39, Sven Barth пишет:

Show quoted text 6 lines
Am 04.03.2013 13:35, schrieb Juha Manninen: > I understand it comes from "ld". Is patching "ld" the only way? No, this can't be changed without patching ld. Though you could try the new internal ELF linker on systems that already support it (AFAIK i386, x86_64 and MIPS (and maybe also ARM)), but I don't know whether it already supports all features (like building shared libraries).

What do you think about suppressing the warning inside fpc by filtrating ld stderr? I do it manually in my Makefile:

ifeq ($(OPERATING_SYSTEM),Linux)
LD_WAR:=ld: warning: link.res contains output sections; did you forget -T?$$ FPC_FILTER:=3>&1 1>&2 2>&3 | ( $(GREP) -v '$(WAR)' 3>&2 2>&1 1>&3 || $(NOP) )
else
FPC_FILTER:=
endif
…
$(call CD,$(BUILD_CURDIR)) && $(FPC) $(FPC_OPTIONS) $(PROGNAME).pp -o$(OUTPROGNAME)$(EXEEXT) $(FPC_FILTER)

but I would be happy if fpc will do something like this inside itself :)

Victor Matuzenko (Виктор Матузенко)

Reply by email

Jonas Maebe
to Juha Manninen: Yes, I know this warning can be ignored, and every active member of this list knows it,…
Juha Manninen wrote
Still, is there really no way to get rid of this warning?

Yes, the linker script that FPC uses should be fixed. There is no need whatsoever for FPC to specify output sections. We can just specify the extra .fpc sections and others, and leave the rest of the original linker script alone. However, such a change would require extensive testing on many different platforms.

Well, there is one scenario where you want to specify everything in FPC's built-in linker script: in case you have an internal linker. But then you get the same effect as if you would specify -T option to the linker (only that linker script is used, and the internal linker script of the system linker is ignored). The reason we don't use -T is exactly because we want to use the system linker's default script, because it often contains system-specific library search paths and possibly other directives.

So instead, when we would use an internal ELF linker, we probably should extract the default linker script from the system linker instead and again add our own parts to it, rather than hardcoding some version in the compiler itself.

Jonas

Reply by email