summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2016-08-23 12:20:59 +0930
committerAlan Modra <amodra@gmail.com>2016-08-23 12:21:25 +0930
commiteacfca90f1ff457d3a7be9d593040218b6208d2b (patch)
tree8891498c746ceb8622a0b6de3479734124befbf1
parented02c2d1944169075bff73de3c31bad80ecdd2c7 (diff)
downloadbinutils-gdb-eacfca90f1ff457d3a7be9d593040218b6208d2b.tar.gz
R_OR1K_GOTOFF_* relocations
PR 20475 * elf32-or1k.c (or1k_elf_relocate_section): Offset from _GLOBAL_OFFSET_TABLE_, not start of .got section.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-or1k.c5
2 files changed, 10 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 87823ee192f..1aad274f1dc 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 0035f8e7dfe..3351ba6860d 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: