Bug#844782: Please revert problematic sparc64 GOT patch

2016-11-18 Thread John Paul Adrian Glaubitz
On 11/19/2016 01:37 AM, James Clarke wrote:
> [1] b19753ce31da347605dfa903c6fd2158e2444f0d

Attaching the reversed patch which applies cleanly against git master
for binutils-gdb when removing the part that patches the upstream
changelog.

Fixing this is important, it causes quite a number of segfaults. I suspect
this is also the reason why cmake fails to build from source.

Thanks,
Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
diff --git b/bfd/elfxx-sparc.c a/bfd/elfxx-sparc.c
index 30daedf..63558c7 100644
--- b/bfd/elfxx-sparc.c
+++ a/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;


Bug#844782: Please revert problematic sparc64 GOT patch

2016-11-18 Thread James Clarke
Source: binutils
Version: 2.27.51.20161118-1
Severity: important
User: debian-sp...@lists.debian.org
Usertags: sparc64
X-Debbugs-Cc: debian-sp...@lists.debian.org

Hi Matthias,
While global symbol references are now fine, we've noticed that TLS is
broken in a similar way, except in this case the linker can't do much to
fix it up unless it wants to patch the opcodes themselves. This has the
very bad side effect of causing apt-get to segfault in libstdc++. Until
this gets properly dealt with upstream, could you please revert the
relevant patch[1]?

James

[1] b19753ce31da347605dfa903c6fd2158e2444f0d