rtld: resolve incoming STT_GNU_IFUNC only after DT_INIT

Florian Weimer fw@deneb.enyo.de
Wed Nov 1 16:35:00 GMT 2017


* John Reiser:

> When loading a shared library, either DT_NEEDED or via dlopen(),
> then the processing by rtld of relocations in other modules which
> refer to STT_GNU_IFUNC symbols in the current library causes
> problems for me.  Relocating a reference from outside to a
> STT_GNU_IFUNC symbol causes the IFUNC code to be called before the
> DT_INIT executes.  This is not nice.

But this is required because the DT_INIT code may need IFUNC-backed
relocations.  And there is no way to tell which relocations are needed
for DT_INIT and which are just required afterwards.

> It seems to me that rtld could change the order of evaluation, so that
> DT_INIT is called before any other code in the library is executed,
> including the code for resolving incoming references to STT_GNU_IFUNC
> symbols in the library.  Comments?

I don't think this is possible at all.



More information about the Libc-alpha mailing list