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: ccoutant at gmail dot com
Subject: [Bug ld/27441] Small inconsistency in between gold and bfd
Date: Mon, 08 Mar 2021 18:14:24 +0000

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

Cary Coutant <ccoutant at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ccoutant at gmail dot com

--- Comment #18 from Cary Coutant <ccoutant at gmail dot com> ---
> > 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:

--as-needed
--no-as-needed
This option affects ELF DT_NEEDED tags for dynamic libraries mentioned on the
command line after the --as-needed option. Normally the linker will add a
DT_NEEDED tag for each dynamic library mentioned on the command line,
regardless of whether the library is actually needed or not. --as-needed causes
a DT_NEEDED tag to only be emitted for a library 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. Object
files or libraries appearing on the command line after the library in question
do not affect whether the library is seen as needed. This is similar to the
rules for extraction of object files from archives. --no-as-needed restores the
default behaviour.

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)

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