This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Forcing BIND_NOW for a symbol
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-help <libc-help at sourceware dot org>
- Date: Mon, 2 Nov 2015 11:12:16 -0500
- Subject: Re: Forcing BIND_NOW for a symbol
- Authentication-results: sourceware.org; auth=none
- References: <56376829 dot 7050707 at redhat dot com> <56377C77 dot 2010209 at redhat dot com> <56377EEA dot 3030302 at redhat dot com>
On 11/02/2015 10:19 AM, Florian Weimer wrote:
>>> I'm interested in both the case where this is a completely new symbol
>>> (so we can do anything we want to make this happen), and existing
>>> versioned function symbol.
>>
>> How are they any different?
>
> For new interfaces, we can mark them in some way when the final link
> happens with ld. For existing binaries, we would have to traverse the
> list of unresolved symbols at least once, and I think lazy binding is
> there to avoid exactly that.
Correct, each undefined symbol would have to get matched up to the definition
to determine if the definition was declared STT_GNU_IFUNC. Which is equivalent
to LD_BIND_NOW=1. The optimization is to mark such undefined uses in some way
and use that list to reduce the number of lookups required.
Did I understand that right?
>>> The idea is to ensure that if there is an IFUNC handler for the symbol,
>>> the handler is called at load time, and not later during program execution.
>>
>> Why?
>
> I think it's needed for a high-quality implementation of getrandom with
> an emulation that cannot fail.
Exactly what failure modes are you considering?
Cheers,
Carlos.