Forcing BIND_NOW for a symbol

Carlos O'Donell carlos@redhat.com
Mon Nov 2 16:12:00 GMT 2015


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.



More information about the Libc-help mailing list