This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] [ARC] Fixes related to reordering of .got and .got.plt
- From: Claudiu Zissulescu <claziss at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 13 Jun 2016 14:26:24 -0000
- Subject: [binutils-gdb] [ARC] Fixes related to reordering of .got and .got.plt
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3b63d2cee1e6b894981cab59183480ac0972146a
commit 3b63d2cee1e6b894981cab59183480ac0972146a
Author: Cupertino Miranda <cmiranda@synopsys.com>
Date: Thu May 26 16:00:08 2016 +0200
[ARC] Fixes related to reordering of .got and .got.plt
- Correctly solved relocations on the .got header.
- This bug arrised from enabling RELRO (-z combreloc).
Because the .got and .got.plt sections were split in new linker
scripts the header is no longer part of sgotplt contents.
Changed the patch to sgot contents instead.
- Latest fix to .got header relocs.
bfd/
2016-06-13 Cupertino Miranda <cmiranda@synospsy.com>
* elf32-arc.c (elf_arc_finish_dynamic_sections): Changed.
Diff:
---
bfd/ChangeLog | 4 ++++
bfd/elf32-arc.c | 17 ++++++++++++-----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1bec3a0..6dccb38 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,9 @@
2016-06-13 Cupertino Miranda <cmiranda@synospsy.com>
+ * elf32-arc.c (elf_arc_finish_dynamic_sections): Changed.
+
+2016-06-13 Cupertino Miranda <cmiranda@synospsy.com>
+
* elf32-arc.c (arc_local_data, arc_local_data): Removed.
(SECTSTART): Changed.
(elf_arc_relocate_section): Fixed mistake in PIE related
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index bb9cb29..7493a1e 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -2546,17 +2546,24 @@ elf_arc_finish_dynamic_sections (bfd * output_bfd,
/* Fill in the first three entries in the global offset table. */
if (htab->sgot)
{
- if (htab->sgot->size > 0 || htab->sgotplt->size > 0)
+ struct elf_link_hash_entry *h;
+ h = elf_link_hash_lookup (elf_hash_table (info), "_GLOBAL_OFFSET_TABLE_",
+ FALSE, FALSE, TRUE);
+
+ if (h != NULL && h->root.type != bfd_link_hash_undefined
+ && h->root.u.def.section != NULL)
{
+ asection *sec = h->root.u.def.section;
+
if (ds.sdyn == NULL)
bfd_put_32 (output_bfd, (bfd_vma) 0,
- htab->sgotplt->contents);
+ sec->contents);
else
bfd_put_32 (output_bfd,
ds.sdyn->output_section->vma + ds.sdyn->output_offset,
- htab->sgotplt->contents);
- bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + 4);
- bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + 8);
+ sec->contents);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, sec->contents + 4);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, sec->contents + 8);
}
}