ld --as-needed assertion fail, BFD internal error and crash

Alan Modra amodra@bigpond.net.au
Sat Mar 18 23:17:00 GMT 2006


On Sat, Mar 18, 2006 at 10:21:04PM +0300, Dmitry V. Levin wrote:
> Without --as-needed fixes it produced a warning
> /usr/bin/ld: warning: libfoo1.so, needed by ./libfoo2.so, not found (try using -rpath or -rpath-link)
> but linked executable.
> 
> With --as-needed fixes it fails:
> /usr/bin/ld: warning: libfoo1.so, needed by ./libfoo2.so, not found (try using -rpath or -rpath-link)
> ./libfoo2.so: undefined reference to `foo1'
> collect2: ld returned 1 exit status

Yes, that's a bugfix, the ??? in the comment below for the old as-needed
code.

/* Called via elf_link_hash_traverse, elf_smash_syms sets all symbols
   belonging to NOT_NEEDED to bfd_link_hash_new.  We know there are no
   references from regular objects to these symbols.

   ??? Should we do something about references from other dynamic
   obects?  If not, we potentially lose some warnings about undefined
   symbols.  But how can we recover the initial undefined / undefweak
   state?  */

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list