This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Difference in documentation vs implementation of R_X86_64_GOTPC32/64
Hi,
On Mon, 18 Mar 2019, Siva Chandra via binutils wrote:
> Ah, is this what it is:
>
> 1. GOT spans .got and .got.plt.
> 2. Non-negative indices into the GOT are in .got.plt.
> 3. Negative indices into the GOT are in .got.
> 4. The first location of GOT, which is the zero-th entry in GOT, is
> _GLOBAL_OFFSET_TABLE_.
>
> If _this_ is the interpretation, then I am good with everything :)
Mostly, except the section names have no bearing. There might be (and are
in some configs) even more sections that happen to become part of the
global offset table, so there's no inherent relation of index/offset sign
and section, e.g. this still would be a valid layout:
.got
.got.first
_GLOBAL_OFFSET_TABLE_:
.got.second
The important part is that if the psABI talks about GOT then it means the
address of the _GLOBAL_OFFSET_TABLE_ symbol, which in a non-relocatable
file is simply some random address within the writable data segment,
assigned by the link editor.
Ciao,
Michael.