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

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

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

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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

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

Sven Barth-2
Am 04.03.2013 13:35, schrieb 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?
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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

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

Mattias Gaertner
In reply to this post by Juha Manninen
On Mon, 4 Mar 2013 14:35:50 +0200
Juha Manninen <[hidden email]> wrote:

> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

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

Mattias Gaertner

Sorry, I misunderstood the -T warning with the other linker FAQ.


Mattias
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

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

leledumbo
Administrator
In reply to this post by Sven Barth-2
OOT: How to try the new internal linker? -Xi doesn't seem to trigger it. I see in the changelog it works on *BSD, does it work on linux?
Reply | Threaded
Open this post in threaded view
|

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

Виктор Матузенко
In reply to this post by Sven Barth-2
04.03.2013 16:39, Sven Barth пишет:
> 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 (Виктор Матузенко)

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

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

Jonas Maebe-2
In reply to this post by Juha Manninen
On 04/03/13 13:35, 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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal