This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Revert "bfd: allow negative offsets to _GLOBAL_OFFSET_TABLE_ in elf64 SPARC"
- From: Jose E.Marchesi <jemarch at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 19 Nov 2016 12:45:49 -0000
- Subject: [binutils-gdb] Revert "bfd: allow negative offsets to _GLOBAL_OFFSET_TABLE_ in elf64 SPARC"
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0fc9967d0b28a1e037233d49cec479d3ab1e9e59
commit 0fc9967d0b28a1e037233d49cec479d3ab1e9e59
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
Date: Sat Nov 19 04:39:09 2016 -0800
Revert "bfd: allow negative offsets to _GLOBAL_OFFSET_TABLE_ in elf64 SPARC"
This reverts commit b19753ce31da347605dfa903c6fd2158e2444f0d.
As it turns out, GCC (and the assembler) needs additional work in
order to support negative GOT offsets in 64-bit sparc. This is
breaking TLS Local Dynamic in position-independent code.
Diff:
---
bfd/ChangeLog | 5 +++++
bfd/elfxx-sparc.c | 16 ++++++++--------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8a18a6d..f28351d 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-19 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Do not
+ apply the negative GOT offset optimization in 64-bit code.
+
2016-11-18 James Clarke <jrtc27@jrtc27.com>
* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Don't convert
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index e1c7b22..cf30012 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -2661,19 +2661,19 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd,
/* Allocate .plt and .got entries, and space for local symbols. */
htab_traverse (htab->loc_hash_table, allocate_local_dynrelocs, info);
- if (!htab->is_vxworks
+ if (! ABI_64_P (output_bfd)
+ && !htab->is_vxworks
&& elf_hash_table (info)->dynamic_sections_created)
{
- if (! ABI_64_P (output_bfd))
- {
- /* Make space for the trailing nop in .plt. */
- if (htab->elf.splt->size > 0)
- htab->elf.splt->size += 1 * SPARC_INSN_BYTES;
- }
+ /* Make space for the trailing nop in .plt. */
+ if (htab->elf.splt->size > 0)
+ htab->elf.splt->size += 1 * SPARC_INSN_BYTES;
/* If the .got section is more than 0x1000 bytes, we add
0x1000 to the value of _GLOBAL_OFFSET_TABLE_, so that 13
- bit relocations have a greater chance of working. */
+ bit relocations have a greater chance of working.
+
+ FIXME: Make this optimization work for 64-bit too. */
if (htab->elf.sgot->size >= 0x1000
&& elf_hash_table (info)->hgot->root.u.def.value == 0)
elf_hash_table (info)->hgot->root.u.def.value = 0x1000;