bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/27441] Small inconsistency in between gold and bfd


From: matz at suse dot de
Subject: [Bug ld/27441] Small inconsistency in between gold and bfd
Date: Wed, 24 Feb 2021 13:54:29 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=27441

--- Comment #11 from Michael Matz <matz at suse dot de> ---
(In reply to Alan Modra from comment #8)
> (In reply to Michael Matz from comment #3)
> > % gcc -fPIC -Wl,--as-needed -fno-lto -shared -o good.so  bad4.c -L. -l2 -l1
> > % readelf-dW good.so | grep lib
> >  0x0000000000000001 (NEEDED)             Shared library: [lib2.so]
> >  0x0000000000000001 (NEEDED)             Shared library: [lib1.so]
> 
> I'd actually like to fix the above to *not* have DT_NEEDED lib2.so.  The
> reason is that as-needed was supposed to be modeled on the way archive
> entries are treated, and if you were using static libraries you'd find the
> weak func1 in lib2.a would not be enough to cause lib2.o to be extracted.. 

Yes, I thought so as well, until I read ELF.txt again :) :

* When the link editor searches archive libraries, it extracts archive
  members that contain definitions of undefined global symbols. The
  member's definition may be either a global or a weak symbol. The
  link editor does not extract archive members to resolve undefined
  weak symbols. Unresolved weak symbols have a zero value.

"may be either a global or a weak symbol".  It's weak undefs that don't cause
things to be pulled in, but a strong ref should pull in a weak def.

Independend of that I considered the current (non-LTO) behaviour more useful.

> Unfortunately I can't do that, libm.so.6 for instance is full of weak
> dynamic symbols.

(huh, I never noticed that; indeed)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]