[PATCH] x86: Generate PLT relocations for -z now

Florian Weimer fweimer@redhat.com
Wed May 10 12:03:00 GMT 2017


On 05/09/2017 04:55 PM, Szabolcs Nagy wrote:
> i don't think plt should be considered to be part of the dso abi,
> so removing plt relocs should be safe (making a GOT-indirect call
> is a valid optimization, since plt is only there for lazy binding
> which is an optimization too, gcc can change plt relocs to noplt
> ones without -fno-plt so relying on it was never safe).

Sorry, the PLT stubs are for more than just lazy binding.  They are also 
used by the LD_AUDIT facility.  We haven't deprecated that, so we need 
to keep supporting it in some way, I think.

> Alexander Monakov pointed out to me that ld audit could be fixed
> in principle to work with GOT-indirect calls e.g. by generating
> its entry point trampolines on the fly.

I think that's true (as long as the existing relocations are expressive 
enough).  libffi already does that.  But it has some implications for 
restricted environments which do not allow JIT.  We could have some 
generic precompiled stub code as part of a file and map that as needed 
(with a data mapping right in front of it, containing the parameters), 
but I'd rather avoid that complexity.

Thanks,
Florian



More information about the Libc-alpha mailing list