Difference in documentation vs implementation of R_X86_64_GOTPC32/64

Siva Chandra via binutils binutils@sourceware.org
Mon Mar 25 19:21:00 GMT 2019


On Mon, Mar 25, 2019 at 12:12 PM Michael Matz <matz@suse.de> wrote:
> On Mon, 18 Mar 2019, Siva Chandra via binutils wrote:
> > 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.

Thanks a lot. That helps clear up "convention" vs "requirement".



More information about the Binutils mailing list