This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about one offst check in x86-64 bfd code


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]