This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Question about one offst check in x86-64 bfd code
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jiong Wang <jiong dot wang at arm dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Thu, 7 May 2015 05:06:40 -0700
- Subject: Re: Question about one offst check in x86-64 bfd code
- Authentication-results: sourceware.org; auth=none
- References: <n99sib84sv2 dot fsf at arm dot com>
On Thu, May 7, 2015 at 2:38 AM, Jiong Wang <jiong.wang@arm.com> wrote:
>
> Hi HJ,
>
> I see you added the initial IFUNC support for x86-64, I have one
> question about the following code:
>
> at the function "elf_x86_64_relocate_section:"
>
> inside IFUNC handling code:
>
> /* Since STT_GNU_IFUNC symbol must go through PLT, we handle
> it here if it is defined in a non-shared object. */
> if (h != NULL
> && h->type == STT_GNU_IFUNC
> && h->def_regular)
> {
>
> ...
> ...
>
> case R_X86_64_GOTPCREL:
> case R_X86_64_GOTPCREL64:
> base_got = htab->elf.sgot;
> off = h->got.offset;
>
> if (base_got == NULL)
> abort ();
>
> if (off == (bfd_vma) -1)
> {
> /* We can't use h->got.offset here to save state, or
> even just remember the offset, as finish_dynamic_symbol
> would use that as offset into .got. */
>
> if (htab->elf.splt != NULL)
> ...
> ...
>
> I am not quite understanding what's the meaning of "off == (bfd_vma)
> -1", in what situation can "off" be -1? I am just wondering the global
> symbol should always be recorded and thus with a positive offset, at
> least on AArch64.
>
elf_x86_64_allocate_dynrelocs uses h->got.offset to save state.
-1 and -2 are used.
--
H.J.