PATCH: Add STB_SECONDARY support

H.J. Lu hjl.tools@gmail.com
Wed Jul 4 14:00:00 GMT 2012


On Tue, Jul 3, 2012 at 5:39 PM, Alan Modra <amodra@gmail.com> wrote:
> On Tue, Jul 03, 2012 at 05:18:42PM -0700, H.J. Lu wrote:
>>  0x0000000000000001 (NEEDED)             Shared library:
>> [libbfd-2.22.52.20120703.so]
>>  0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
>>  0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
>>  0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
>>
>> libbfd-2.22.52.20120703.so is linked against libiberty.a.  When you build
>> binutils, libbfd will include a backup copy of standard functions
>> which don't exist
>> in libc.so at the time when you compile it.  Even after you upgrade your
>> libc.so with the latest and greatest standard functions, ld stiil uses
>> the backup one from libiberty since ld.so searches libbfd.so before
>> libc.so.6.
>
> Like I said, I'm sure you could devise a way to put your backup
> functions in another shared library that is searched after libc.so.6
> That's dead easy.  Deeper nesting of shared libraries is a little more
> difficult, due to breadth first library search, but still possible for
> any given depth of libraries.  I imagine this case would be rare
> anyway.

Sure, we can do it on glibc with LD_DYNAMIC_WEAK.
But I haven't found another easy way to achieve the same
result

> Who really is pushing for STB_SECONDARY?  Is it some hide-bound
> company that uses a non-ELF toolchain and doesn't want to adapt any
> process of theirs?
>

STB_SECONDARY is my proposal and we have found
some nice usages.

-- 
H.J.



More information about the Binutils mailing list