This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: What is R_X86_64_GOTPLT64 used for?
- From: Michael Matz <matz at suse dot de>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: "x86-64-abi at googlegroups dot com" <x86-64-abi at googlegroups dot com>, GCC Development <gcc at gcc dot gnu dot org>, Binutils <binutils at sourceware dot org>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 17 Nov 2014 15:05:01 +0100 (CET)
- Subject: Re: What is R_X86_64_GOTPLT64 used for?
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOqb0g2asAe6UZ0hxh8jFf-+eBiaez0pLrPjd0oqVdP0Rg at mail dot gmail dot com> <alpine dot LNX dot 2 dot 00 dot 1411131717220 dot 405 at wotan dot suse dot de> <CAMe9rOrTg=YtVZ1EqN7ha8qUPSXzms20eMU51txVAmL3+cUsQQ at mail dot gmail dot com>
Hi,
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
separately).
> 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.
Ciao,
Michael.