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>, libc-help <libc-help at sourceware dot org>
- Date: Mon, 2 Nov 2015 10:08:39 -0500
- Subject: Re: Forcing BIND_NOW for a symbol
- Authentication-results: sourceware.org; auth=none
- References: <56376829 dot 7050707 at redhat dot com>
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.
> 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?
> 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?
Cheers,
Carlos.