This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: R_OR1K_GOTOFF_* relocations
- From: Stefan Kristiansson <stefan dot kristiansson at saunalahti dot fi>
- To: Alan Modra <amodra at gmail dot com>
- Cc: binutils at sourceware dot org, Christian Svensson <blue at cmd dot nu>, Stefan Kristiansson <stefan dot kristiansson at saunalahti dot fi>, whitequark at whitequark dot org
- Date: Mon, 22 Aug 2016 16:11:21 +0300
- Subject: Re: R_OR1K_GOTOFF_* relocations
- Authentication-results: sourceware.org; auth=none
- References: <20160822014312.GR3677@bubble.grove.modra.org>
On Mon, Aug 22, 2016 at 4:43 AM, Alan Modra <amodra@gmail.com> wrote:
> This change seems a reasonable fix for PR20475 to me, but I could not
> find an up-to-date OR1K ABI describing R_OR1K_GOTOFF_HI and
> R_OR1K_GOTOFF_LO. Also my comments in the PR were before noticing
> that we do have listed maintainers for OR1K. So, asking for comment
> before committing this fix.
>
> PR 20475
> * elf32-or1k.c (or1k_elf_relocate_section): Offset from
> _GLOBAL_OFFSET_TABLE_, not start of .got section.
>
> diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
> index 0035f8e..3351ba6 100644
> --- a/bfd/elf32-or1k.c
> +++ b/bfd/elf32-or1k.c
> @@ -998,7 +998,10 @@ or1k_elf_relocate_section (bfd *output_bfd,
> case R_OR1K_GOTOFF_HI16:
> /* Relocation is offset from GOT. */
> BFD_ASSERT (sgot != NULL);
> - relocation -= sgot->output_section->vma;
> + relocation
> + -= (htab->root.hgot->root.u.def.value
> + + htab->root.hgot->root.u.def.section->output_offset
> + + htab->root.hgot->root.u.def.section->output_section->vma);
> break;
>
> case R_OR1K_INSN_REL_26:
>
Looks good to me.
Stefan