What is R_X86_64_GOTPLT64 used for?

Michael Matz matz@suse.de
Mon Nov 17 14:05:00 GMT 2014


On Thu, 13 Nov 2014, H.J. Lu wrote:

> @GOTPLT will create a PLT entry, but it doesn't mean PLT entry will be 
> used.

Correct.  The compiler was supposed to somehow make a good decision (e.g. 
if there were calls and address-takings in the same unit).

> Only @PLTOFF will use PLT entry.  Linker should be smart enough to use 
> only one GOT slot, regardless if @GOTPLT or @GOT is used to take 
> function address and call via PLT.

For @GOT the respective GOT slot needs to resolve to the final address (to 
provide stable function pointers).  For @GOTPLT it could at first resolve 
to the PLT slot (which would be only a relative reloc, not a symbol based 
one), like Richard said.  So there still would be a difference.  Apart 
from that I agree that the linker should ideally only use one GOT slot, 
which would remove that particular advantage of @GOTPLT (note that it 
doesn't do so currently contrary to what you said downthread, I'll respond 

> I'd like to propose
> 1. Update psABI to remove R_X86_64_GOTPLT64.

I don't have much against this, but would like others to say something.


More information about the Binutils mailing list