This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 3/4] [ARC] Fixes related to recent reordering of .got and .got.plt
- From: Cupertino Miranda <Cupertino dot Miranda at synopsys dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Cc: Nick Clifton <nickc at redhat dot com>, Claudiu Zissulescu <Claudiu dot Zissulescu at synopsys dot com>, Francois Bedard <Francois dot Bedard at synopsys dot com>
- Date: Mon, 13 Jun 2016 10:55:10 +0000
- Subject: [PATCH 3/4] [ARC] Fixes related to recent reordering of .got and .got.plt
- Authentication-results: sourceware.org; auth=none
Hi,
Bug fix related to recent reordering of .got and .got.plt sections.
This bug raised from enabling RELRO (-z combreloc). Because the .got and
.got.plt sections were split in new linker scripts the header is no
longer always part of .got.plt contents.
Best regards,
Cupertino
bfd/ChangeLog:
Cupertino Miranda <cmiranda@synospsy.com>
elf32-arc.c (elf_arc_finish_dynamic_sections): Changed.
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index 3fe822a..80991fc 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -2541,17 +2541,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);
}
}
--
1.9.1