Usage of rtld_active() in dlfcn functions

Fengkai Sun qcloud1014@gmail.com
Thu Sep 3 07:17:20 GMT 2020


Hi list,

I've noticed that every function in dlfcn.h calls rtld_active() at the very
beginning of their implementation, and use _dlfcn_hook to actually call
those functions.

In sysdeps/generic/ldsodefs.h it says about this function "Return true if
the ld.so copy in this namespace is actually active and working. If false,
the dl_open/dlfcn hooks have to be used to call into the outer dynamic
linker (which happens after static dlopen)".

My question is, why can dlfcn functions be called before ld.so is
initialized? Obviously a program written by the user cannot do that, and I
can't find the reference to dlfcn functions in rtld.c.
So what is rtld_active() used for?

Additionally, what does "static dlopen" mean?


Many thanks,
Fengkai


More information about the Libc-help mailing list