R_OR1K_GOTOFF_* relocations
authorAlan Modra <amodra@gmail.com>
Tue, 23 Aug 2016 02:50:59 +0000 (12:20 +0930)
committerAlan Modra <amodra@gmail.com>
Tue, 23 Aug 2016 02:51:25 +0000 (12:21 +0930)
PR 20475
* elf32-or1k.c (or1k_elf_relocate_section): Offset from
_GLOBAL_OFFSET_TABLE_, not start of .got section.

bfd/ChangeLog
bfd/elf32-or1k.c

index 87823ee192f63041a602fee4f933b81550704e63..1aad274f1dc1623690508c2dab354b9056e36cf1 100644 (file)
@@ -1,3 +1,9 @@
+2016-08-23  Alan Modra  <amodra@gmail.com>
+
+       PR 20475
+       * elf32-or1k.c (or1k_elf_relocate_section): Offset from
+       _GLOBAL_OFFSET_TABLE_, not start of .got section.
+
 2016-08-22  Nick Clifton  <nickc@redhat.com>
 
        * doc/chew.c (main): Free the string buffer used to files as they
index 0035f8e7dfe6d82de7111dfdf626b2c6970f359d..3351ba6860d25a9beb63d37df67c18dabd232e05 100644 (file)
@@ -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: