Static Linking

Jonathan Nieder jrnieder@gmail.com
Tue Feb 22 19:56:00 GMT 2011


Julius Schmidt wrote:

> There seem to be some other functions (dlopen, ...); is there a
> comprehensive list?

Searching for "dlopen (" in the glibc source code should find all of
them.

Note that the libnss functions _use_ dlopen.  dlopen is a pretty
fundamental facility on POSIX systems.  It generally gets used for
plugins (so higher-level libraries that use plugins will have the same
difficulties) but can be used for other things, too.

> I don't think --enable-static-nss fixes all of them,
> does it?

I supposed you'd also want to set STATIC_GCONV, for mbstowcs et al.

>> libc has a very stable ABI so linking
>> dynamically to it is just as good (better, actually) if you are
>> careful about not linking to too-new symbols.
>
> Is there some recipe how to be careful about this?

Not sure --- maybe others can help.  I was thinking of things like new
functions (which obviously won't work on libc versions that don't have
them) and the minimum OS ABI tag (see LD_ASSUME_KERNEL in ld.so(8)).

I'd suggest just trying out the result on the oldest platform
you're interested in.

Kind regards,
Jonathan



More information about the Libc-help mailing list