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: Tue, 09 Mar 2021 14:04:40 +0000

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

--- Comment #20 from Michael Matz <matz at suse dot de> ---
(In reply to Cary Coutant from comment #18)
> > > My understanding of when a shared object is needed:
> > > 
> > > * it is linked at least once in --no-as-needed mode (i.e. --as-needed a.so
> > > --no-as-needed a.so => needed)
> > > * or it has a non-weak definition resolving a reference from a live 
> > > section
> > > (not discarded by --gc-sections)
> > > 
> > > I think both LLD and gold's rules are like this.
> > 
> > Then they both have the same bug (in the second item of your list).  As Alan
> > explains, as-needed behaviour intends to reflect behaviour of static 
> > archives
> > (where that applies; here any difference in behaviour doesn't seem useful).
> > 
> > The only thing about weak definitions is that there may be validly multiple
> > ones
> > without error (the first one or the single non-weak definition wins).
> 
> This contradicts the ld manual:
> ...
> Note where it says "that at that point in the link satisfies a *non-weak*
> undefined symbol reference from a regular object file or, if the library is
> not found in the DT_NEEDED lists of other needed libraries, a *non-weak*
> undefined symbol reference from another needed dynamic library." (emphasis
> added)

Right.  This describes the static archive extraction rules.  It talks about
(non-weak i.e. strong) references, not about (weak) definitions.  Weak (and
strong) definitions do satisfy strong references, and hence invoke the above
rules about archive member extraction (and therefore should then also cause
the same behaviour for DT_NEEDED).

-- 
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]