[binutils] backport some testsuite fixes from upstream

Kyle McMartin kyle at fedoraproject.org
Tue Jun 24 19:41:50 UTC 2014


commit cd1fc1360a1df48672ac75bca3265bd5fdbd6ed2
Author: Kyle McMartin <kmcmarti at redhat.com>
Date:   Tue Jun 24 15:30:41 2014 -0400

    backport some testsuite fixes from upstream

 ...tils-2.24-aarch64-ld-shared-non-PIC-xfail.patch |   55 ++++++++++
 binutils-2.24-arm-static-tls.patch                 |   42 +++++++
 binutils-2.24-fat-lto-objects.patch                |   57 ++++++++++
 binutils-2.24-symbol-warning.patch                 |  114 ++++++++++++++++++++
 binutils.spec                                      |   20 ++++-
 5 files changed, 287 insertions(+), 1 deletions(-)
---
diff --git a/binutils-2.24-aarch64-ld-shared-non-PIC-xfail.patch b/binutils-2.24-aarch64-ld-shared-non-PIC-xfail.patch
new file mode 100644
index 0000000..8525596
--- /dev/null
+++ b/binutils-2.24-aarch64-ld-shared-non-PIC-xfail.patch
@@ -0,0 +1,55 @@
+commit 273dc279306c2b69fbc1407cc695397e4b015152
+Author: Will Newton <will.newton at linaro.org>
+Date:   Fri May 16 15:22:58 2014 +0100
+
+    ld/aarch64: xfail non-PIC shared object tests on aarch64
+    
+    aarch64 does not support building non-PIC shared objects, so mark
+    tests for these as xfail.
+    
+    ld/testsuite/ChangeLog:
+    
+    2014-05-20  Will Newton  <will.newton at linaro.org>
+    
+    	* ld-shared/shared.exp: Mark non-PIC shared object tests
+    	as xfail on aarch64.
+
+#-- a/ld/testsuite/ChangeLog
+#++ b/ld/testsuite/ChangeLog
+#@ -1,3 +1,8 @@
++2014-05-20  Will Newton  <will.newton at linaro.org>
++
++	* ld-shared/shared.exp: Mark non-PIC shared object tests
++	as xfail on aarch64.
++
+ 2014-05-19  Andreas Tobler  <andreast at fgznet.ch>
+ 
+ 	* ld-elf/shared.exp: Introduce the extralibs variable to control
+diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp
+index 9996ece..c723ef7 100644
+--- a/ld/testsuite/ld-shared/shared.exp
++++ b/ld/testsuite/ld-shared/shared.exp
+@@ -244,6 +244,7 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o]
+ 	if [ string match $shared_needs_pic "yes" ] {
+ 	    setup_xfail "arm*-*-linux*"
+ 	}
++	setup_xfail "aarch64*-*-linux*"
+ 	shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o shared
+ 
+ 	# Test ELF shared library relocations with a non-zero load
+@@ -270,6 +271,7 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o]
+ 	if [ string match $shared_needs_pic "yes" ] {
+ 	    setup_xfail "arm*-*-linux*"
+ 	}
++	setup_xfail "aarch64*-*-linux*"
+ 	shared_test shnp "shared (non PIC, load offset)" \
+ 		mainnp.o sh1np.o sh2np.o shared \
+ 		"-T $srcdir/$subdir/elf-offset.ld"
+@@ -326,6 +328,7 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdir/m
+ 	    if [ string match $shared_needs_pic "yes" ] {
+ 		setup_xfail "arm*-*-linux*"
+ 	    }
++	    setup_xfail "aarch64*-*-linux*"
+ 	    shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o shared
+ 	}
+     } else {
diff --git a/binutils-2.24-arm-static-tls.patch b/binutils-2.24-arm-static-tls.patch
new file mode 100644
index 0000000..2b580f1
--- /dev/null
+++ b/binutils-2.24-arm-static-tls.patch
@@ -0,0 +1,42 @@
+commit eea6dad2b3ae91189caa91145dd133bae0398d21
+Author: Kyle McMartin <kyle at redhat.com>
+Date:   Fri Jun 20 11:14:09 2014 +0100
+
+    Similarly to the AArch64 patch, set DF_STATIC_TLS for consistency with
+    other architectures when we emit IE relocs in a shared library.
+    
+    	* elf32-arm.c (elf32_arm_check_relocs): Set DF_STATIC_TLS when
+    	emitting initial-exec relocs when not linking an executable.
+
+--- a/bfd/elf32-arm.c
++++ b/bfd/elf32-arm.c
+@@ -12711,6 +12711,9 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
+ 		default: tls_type = GOT_NORMAL; break;
+ 		}
+ 
++	      if (!info->executable && (tls_type & GOT_TLS_IE))
++		info->flags |= DF_STATIC_TLS;
++
+ 	      if (h != NULL)
+ 		{
+ 		  h->got.refcount++;
+--- a/ld/testsuite/ld-arm/tls-gdierelax2.d
++++ b/ld/testsuite/ld-arm/tls-gdierelax2.d
+@@ -11,13 +11,13 @@ Disassembly of section .text:
+     [0-9a-f]+:	e59f0004 	ldr	r0, \[pc, #4\]	; .*
+     [0-9a-f]+:	e79f0000 	ldr	r0, \[pc, r0\]
+     [0-9a-f]+:	e1a00000 	nop			; .*
+-    [0-9a-f]+:	00008098 	.word	0x00008098
+-    [0-9a-f]+:	0000809c 	.word	0x0000809c
++    [0-9a-f]+:	000080a0 	.word	0x000080a0
++    [0-9a-f]+:	000080a4 	.word	0x000080a4
+ 
+ [0-9a-f]+ <bar>:
+     [0-9a-f]+:	4801      	ldr	r0, \[pc, #4\]	; .*
+     [0-9a-f]+:	4478      	add	r0, pc
+     [0-9a-f]+:	6800      	ldr	r0, \[r0, #0\]
+     [0-9a-f]+:	46c0      	nop			; .*
+-    [0-9a-f]+:	0000808a 	.word	0x0000808a
+-    [0-9a-f]+:	0000808c 	.word	0x0000808c
++    [0-9a-f]+:	00008092 	.word	0x00008092
++    [0-9a-f]+:	00008094 	.word	0x00008094
diff --git a/binutils-2.24-fat-lto-objects.patch b/binutils-2.24-fat-lto-objects.patch
new file mode 100644
index 0000000..fe9c334
--- /dev/null
+++ b/binutils-2.24-fat-lto-objects.patch
@@ -0,0 +1,57 @@
+commit b35d44f1af711925bfa4344ef00470fee67122f1
+Author: Kyrylo Tkachov <kyrylo.tkachov at arm.com>
+Date:   Wed Nov 27 13:43:39 2013 +0000
+
+    [ld/testsuite/]
+    2013-11-27  Kyrylo Tkachov  <kyrylo.tkachov at arm.com>
+    
+    	* ld-plugin/lto.exp: Add -ffat-lto-objects.
+    	* lib/ld-lib.exp (check_lto_available): Likewise.
+
+--- a/ld/testsuite/ld-plugin/lto.exp
++++ b/ld/testsuite/ld-plugin/lto.exp
+@@ -57,7 +57,7 @@ set lto_link_tests {
+    "" "-O2"
+    {lto-3c.c} {} "libdummy.a"}
+   {"Build liblto-3.a"
+-   "" "-flto"
++   "" "-flto -ffat-lto-objects"
+    {lto-3b.c} {} "liblto-3.a"}
+   {"Build libdummy.a 5a"
+    "" "-flto"
+@@ -111,7 +111,7 @@ set lto_link_tests {
+    "" ""
+    {pr12758a.s} {} "libdummy.a"}
+   {"Build libpr12758.a"
+-   "" "-flto -O2"
++   "" "-flto -O2 -ffat-lto-objects"
+    {pr12758b.c} {} "libpr12758.a"}
+   {"PR ld/12758"
+    "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12758a.o -Wl,--start-group tmpdir/libpr12758.a -Wl,--end-group" ""
+@@ -120,13 +120,13 @@ set lto_link_tests {
+    "" ""
+    {pr12760a.c} {} "libdummy.a"}
+   {"Build libpr12760.a"
+-   "" "-flto -O2"
++   "" "-flto -O2 -ffat-lto-objects"
+    {pr12760b.c} {} "libpr12760.a"}
+   {"PR ld/12760"
+    "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12760a.o -Wl,--start-group tmpdir/libpr12760.a -Wl,--end-group" ""
+    {dummy.c} {} "pr12760.exe" "c" "warning: Bad bar"}
+   {"Build libpr13183.a"
+-   "-T" "-flto -O2"
++   "-T" "-flto -O2 -ffat-lto-objects"
+    {pr13183a.c} {} "libpr13183.a"}
+   {"Build libdummy.a PR ld/13183"
+    "" "-flto -O2"
+--- a/ld/testsuite/lib/ld-lib.exp
++++ b/ld/testsuite/lib/ld-lib.exp
+@@ -1643,7 +1643,7 @@ proc check_lto_available { } {
+ 	set f [open $src "w"]
+ 	puts $f ""
+ 	close $f
+-	set status [remote_exec host $CC "-shared -B[pwd]/tmpdir/ld/ -flto -fuse-linker-plugin $src -o $output"]
++	set status [remote_exec host $CC "-shared -B[pwd]/tmpdir/ld/ -flto -ffat-lto-objects -fuse-linker-plugin $src -o $output"]
+ 	if { [lindex $status 0] == 0 } {
+ 	    set lto_available_saved 1
+ 	} else {
diff --git a/binutils-2.24-symbol-warning.patch b/binutils-2.24-symbol-warning.patch
new file mode 100644
index 0000000..aff6c48
--- /dev/null
+++ b/binutils-2.24-symbol-warning.patch
@@ -0,0 +1,114 @@
+From 4c6d802e592b3762a149c343bc5722e065e57841 Mon Sep 17 00:00:00 2001
+From: H.J. Lu <hjl.tools at gmail.com>
+Date: Wed, 26 Mar 2014 12:18:59 -0700
+Subject: [PATCH] Scan all input files for symbol reference warning
+
+This patch scans all input files for symbol reference warning if the
+symbol reference doesn't exist in the current input file.
+
+ld/
+
+	PR ld/16756
+	* ldmain.c (symbol_warning): New function.
+	(warning_callback): Use it.  Scan all input files for a reference
+	to SYMBOL.
+
+ld/testsuite/
+
+	PR ld/16756
+	* ld-plugin/lto.exp: Expect filename and line number for PR
+	ld/12760 test.
+---
+ ld/ChangeLog                   |    7 ++++
+ ld/ldmain.c                    |   43 ++++++++++++++++----------
+ ld/testsuite/ChangeLog         |   64 ++++++++++++++++++++++------------------
+ ld/testsuite/ld-plugin/lto.exp |    4 +-
+ 4 files changed, 70 insertions(+), 48 deletions(-)
+
+diff --git a/ld/ldmain.c b/ld/ldmain.c
+index ffc9f84..14253a6 100644
+--- a/ld/ldmain.c
++++ b/ld/ldmain.c
+@@ -1150,6 +1150,25 @@ struct warning_callback_info
+   asymbol **asymbols;
+ };
+ 
++/* Look through the relocs to see if we can find a plausible address
++   for SYMBOL in ABFD.  Return TRUE if found.  Otherwise return FALSE.  */
++
++static bfd_boolean
++symbol_warning (const char *warning, const char *symbol, bfd *abfd)
++{
++  struct warning_callback_info cinfo;
++
++  if (!bfd_generic_link_read_symbols (abfd))
++    einfo (_("%B%F: could not read symbols: %E\n"), abfd);
++
++  cinfo.found = FALSE;
++  cinfo.warning = warning;
++  cinfo.symbol = symbol;
++  cinfo.asymbols = bfd_get_outsymbols (abfd);
++  bfd_map_over_sections (abfd, warning_find_reloc, &cinfo);
++  return cinfo.found;
++}
++
+ /* This is called when there is a reference to a warning symbol.  */
+ 
+ static bfd_boolean
+--- a/ld/ldmain.c	2014-06-24 14:04:00.700594584 -0400
++++ b/ld/ldmain.c	2014-06-24 14:07:19.452270808 -0400
+@@ -1172,24 +1172,14 @@
+     einfo ("%P: %s%s\n", _("warning: "), warning);
+   else if (symbol == NULL)
+     einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
+-  else if ((abfd->flags & BFD_PLUGIN) == 0)
++  else if (! symbol_warning (warning, symbol, abfd))
+     {
+-      struct warning_callback_info cinfo;
+-
+-      /* Look through the relocs to see if we can find a plausible
+-	 address.  */
+-
+-      if (!bfd_generic_link_read_symbols (abfd))
+-	einfo (_("%B%F: could not read symbols: %E\n"), abfd);
+-
+-      cinfo.found = FALSE;
+-      cinfo.warning = warning;
+-      cinfo.symbol = symbol;
+-      cinfo.asymbols = bfd_get_outsymbols (abfd);
+-      bfd_map_over_sections (abfd, warning_find_reloc, &cinfo);
+-
+-      if (! cinfo.found)
+-	einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
++      bfd *b;
++      /* Search all input files for a reference to SYMBOL.  */
++      for (b = info->input_bfds; b; b = b->link_next)
++	if (b != abfd && symbol_warning (warning, symbol, b))
++	  return TRUE;
++      einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
+     }
+ 
+   return TRUE;
+diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
+index af7307f..53543a6 100644
+--- a/ld/testsuite/ld-plugin/lto.exp
++++ b/ld/testsuite/ld-plugin/lto.exp
+@@ -116,14 +116,14 @@ set lto_link_tests {
+    "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12758a.o -Wl,--start-group tmpdir/libpr12758.a -Wl,--end-group" ""
+    {dummy.c} {} "pr12758.exe"}
+   {"Build libdummy.a PR ld/12760"
+-   "" ""
++   "" "-g -O0"
+    {pr12760a.c} {} "libdummy.a"}
+   {"Build libpr12760.a"
+    "" "-flto -O2 -ffat-lto-objects"
+    {pr12760b.c} {} "libpr12760.a"}
+   {"PR ld/12760"
+    "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12760a.o -Wl,--start-group tmpdir/libpr12760.a -Wl,--end-group" ""
+-   {dummy.c} {} "pr12760.exe" "c" "warning: Bad bar"}
++   {dummy.c} {} "pr12760.exe" "c" "pr12760a.c:6: warning: Bad bar"}
+   {"Build libpr13183.a"
+    "-T" "-flto -O2 -ffat-lto-objects"
+    {pr13183a.c} {} "libpr13183.a"}
+-- 
+1.7.1
diff --git a/binutils.spec b/binutils.spec
index 2ce6ad9..403aa68 100644
--- a/binutils.spec
+++ b/binutils.spec
@@ -17,7 +17,7 @@
 Summary: A GNU collection of binary utilities
 Name: %{?cross}binutils%{?_with_debug:-debug}
 Version: 2.24
-Release: 15%{?dist}
+Release: 16%{?dist}
 License: GPLv3+
 Group: Development/Tools
 URL: http://sources.redhat.com/binutils
@@ -59,6 +59,10 @@ Patch17: binutils-2.24-set-section-macros.patch
 Patch18: binutils-2.24-fake-zlib-sections.patch
 # Fix detections little endian PPC shared libraries
 Patch19: binutils-2.24-ldforcele.patch
+Patch20: binutils-2.24-arm-static-tls.patch
+Patch21: binutils-2.24-fat-lto-objects.patch
+Patch22: binutils-2.24-symbol-warning.patch
+Patch23: binutils-2.24-aarch64-ld-shared-non-PIC-xfail.patch
 
 Provides: bundled(libiberty)
 
@@ -182,6 +186,10 @@ using libelf instead of BFD.
 %ifarch ppc64le
 %patch19 -p0 -b .ldforcele~
 %endif
+%patch20 -p1 -b .armstatictls~
+%patch21 -p1 -b .fatlto~
+%patch22 -p1 -b .symwarn~
+%patch23 -p1 -b .ld-aarch64-xfails~
 
 # We cannot run autotools as there is an exact requirement of autoconf-2.59.
 
@@ -492,6 +500,16 @@ exit 0
 %endif # %{isnative}
 
 %changelog
+* Tue Jun 24 2014 Kyle McMartin <kyle at redhat.com> - 2.24-16
+- Backport a couple LTO testsuite fixes from HEAD.
+  Default to -ffat-lto-objects for some ld tests, which was the default in
+  gcc 4.8, but changed in 4.9, and resulted in some failures.
+- Add STATIC_TLS flag on ARM when IE relocs are emitted in a shared
+  library. Also fix up offsets in the testsuite resulting from the
+  addition of the flags.
+- XFail some ld tests on AArch64 to cut some of the spurious testsuite
+  failures down.
+
 * Sat Jun 07 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.24-15
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 


More information about the scm-commits mailing list