This is the mail archive of the
mailing list for the binutils project.
Re: Difference in documentation vs implementation of R_X86_64_GOTPC32/64
- From: "Siva Chandra via binutils" <binutils at sourceware dot org>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: binutils at sourceware dot org, Cary Coutant <ccoutant at gmail dot com>
- Date: Mon, 18 Mar 2019 14:59:53 -0700
- Subject: Re: Difference in documentation vs implementation of R_X86_64_GOTPC32/64
- References: <CAGyQ6gxo0fx-EuFJ6RXAS9XRP73_PnU7v3pVVyfds0qoT1BgUA@mail.gmail.com> <CAMe9rOr+7DOEcSbW+kmTP2TGEm2nD9enDubEYn2iSb+0Khfirstname.lastname@example.org>
- Reply-to: Siva Chandra <sivachandra at google dot com>
On Mon, Mar 18, 2019 at 2:05 PM H.J. Lu <email@example.com> wrote:
> On 3/19/19, Siva Chandra via binutils <firstname.lastname@example.org> wrote:
> > Hello,
> > The documentation I have at hand for the x86_64 ABI says the
> > R_X86_64_GOTPC32/64 should be evaluated as:
> > GOT + A - P
> > where GOT is the address of the global offset table, A the addend, and
> > P the program counter. But, I notice that, the implementations
> > actually interpret GOT as the address of .got.plt.
> > Also, it seems to me that a similar interpretation is also applied to
> > R_X86_64_GOTOFF64, R_386_GOTPC and R_386_GOTOFF.
> > Is there any reason why GOT is interpreted to be the address of
> > .got.plt? Or, is it a defect in the documentation?
> In 5.2 Dynamic Linking, there are
> The symbol _GLOBAL_OFFSET_TABLE_ may reside in the middle of the .got section,
> allowing both negative and non-negative offsets into the array of addresses.
So, if I understand you correctly:
1. GOT is different from .got.
2. GOT is in .got, but not necessarily at the at the beginning of .got.
3. First entry in the GOT is _GLOBAL_OFFSET_TABLE_.
So, how does one view what .got.plt is?