bug-binutils
[Top][All Lists]
Advanced

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

[Bug gold/15478] -no-as-needed required to avoid runtime symbol lookup e


From: ccoutant at google dot com
Subject: [Bug gold/15478] -no-as-needed required to avoid runtime symbol lookup error
Date: Mon, 20 May 2013 16:46:00 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=15478

--- Comment #9 from Cary Coutant <ccoutant at google dot com> 2013-05-20 
16:46:00 UTC ---
> Here is the documentation from older binutils which talks about --as-needed
> interpreting undefined symbols both .o and .so files:
>
>        --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
>            satisfies an undefined symbol reference from a
>            regular object file or, if the library is not
>            found in the DT_NEEDED lists of other libraries
>            linked up to that point, an undefined symbol
>            reference from another dynamic library.
>            --no-as-needed restores the default behaviour.

That is rather explicit, isn't it? For gold to match this behavior, I
think all we need to do is remove the test for sym->in_reg() in the
following code in Symbol_table::set_dynsym_indexes:

 // If the symbol is defined in a dynamic object and is
 // referenced strongly in a regular object, then mark the
 // dynamic object as needed.  This is used to implement
 // --as-needed.
 if (sym->is_from_dynobj()
     && sym->in_reg()
     && !sym->is_undef_binding_weak())
   sym->object()->set_is_needed();

Ian, what do you think?

-cary

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- 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]