This is the mail archive of the libc-help@sourceware.org mailing list for the glibc 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]

Re: Forcing BIND_NOW for a symbol


On 11/02/2015 04:08 PM, Carlos O'Donell wrote:
> On 11/02/2015 08:42 AM, Florian Weimer wrote:
>> Is there a way to tell the dynamic linker to resolve a function symbol
>> at load time, and not later, when the function is called?
> 
> Well, it's LD_BIND_NOW=1 env var, or -z now, but that does all the symbols
> not just one.
> 
> There is no way to resolve just one function at load time.
> 
> Implementing such a feature should not be that difficult, all the machinery
> is in place. You'd need a way to list the functions you wanted bound at
> load time, and then handle that at load time or dlopen time.

Okay.

>> 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.

>> 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.

Florian


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