Changed behaviour of --as-needed
Alan Modra
amodra@bigpond.net.au
Tue Mar 28 02:10:00 GMT 2006
On Mon, Mar 27, 2006 at 03:54:23PM +0200, Andreas Schwab wrote:
> Note that liba.so is not linked against -lm. Now when trying to link them
> together while using --as-needed, I get an undefined references:
>
> $ gcc main.o liba.so -Wl,-as-needed -lm
> liba.so: undefined reference to `log'
>
> This is a side effect of the patch for PR 2434. Is this the intended
> behaviour?
Yes. Prior to the PR2434 fix, the link would proceed but at runtime
you would get an error.
$ LD_LIBRARY_PATH=. ./a.out
./a.out: relocation error: ./liba.so: undefined symbol: log
Not reporting the undefined symbol at link time was simply a bug.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Binutils
mailing list