LD_PRELOAD doesn't work with dynamic object built with `-static-pie`

Florian Weimer fweimer@redhat.com
Tue May 21 06:02:00 GMT 2019


* Baojun Wang:

> I tried to build a shared object with `-static-pie`, and then used it as
> `LD_PRELOAD`, but it didn't work, do you know why it failed?

This will not work for multiple reasons.  The static PIE object will not
have a dynamic symbol table, so no interposition takes place.  It also
uses relocations which are not supported in ELF shared objects.

glibc 2.30 will provide a clearer diagnostic for this, rejecting loading
the object outright.

Thanks,
Florian



More information about the Libc-help mailing list