This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]


On Tue, Jul 3, 2012 at 4:45 PM, Alan Modra <> wrote:
> On Tue, Jul 03, 2012 at 09:26:11AM -0700, H.J. Lu wrote:
>> This scheme works for simple link-time backup.
> Right.  I thought that's what you wanted, because run-time backup can
> be done easily right now.
>>  It doesn't
>> work with backup symbol defined in DSO. You can't override
>> it at run-time.
> If you want run-time backup, use a shared library for your backup.
> The ELF spec has well defined search order rules for resolving
> multiple global symbols in shared libraries.  I'm sure you know the
> rules, and could devise a way of linking a backup library.
> Needing to provide a backup implementation of some function isn't a
> new thing.  How have we managed without secondary symbols in over 20
> years since ELF was invented?

Take binutils as an example, when you use --enable-shared, you

[hjl@gnu-6 local]$ readelf -d ./bin/ld

Dynamic section at offset 0xca530 contains 28 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library:
 0x0000000000000001 (NEEDED)             Shared library: []
 0x0000000000000001 (NEEDED)             Shared library: []
 0x0000000000000001 (NEEDED)             Shared library: [] is linked against libiberty.a.  When you build
binutils, libbfd will include a backup copy of standard functions
which don't exist
in at the time when you compile it.  Even after you upgrade your with the latest and greatest standard functions, ld stiil uses
the backup one from libiberty since searches before  STB_SECONDARY solves this problem by making the
backup copy "dynamic weak".  The  the latest and greatest standard
functions in will be used instead of the backup copy in


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]