[committed 1/5] PR ld/20828: Relax symbol ordering in tests

Maciej W. Rozycki macro@imgtec.com
Mon Jan 23 11:35:00 GMT 2017


Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols 
wrongly forced local with section GC") and make tests check for the 
presence of global `_fdata' and `_edata' symbols separately, removing 
any dependency on symbol table ordering for tests to succeed and 
removing:

FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared library)
FAIL: PR ld/20828 dynamic symbols with section GC (plain)

failures with the `x86_64-solaris2' target, which has additional 
intervening entries:

Symbol table '.dynsym' contains 6 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT    1 _fdata
     2: 0000000000000000     0 OBJECT  GLOBAL DEFAULT    1 _DYNAMIC
     3: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS _PROCEDURE_LINKAGE_TABLE_
     4: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT    1 _edata
     5: 00000000000001b8     0 OBJECT  GLOBAL DEFAULT    4 _GLOBAL_OFFSET_TABLE_

Rename dump pattern files accordingly for consistency.

	ld/
	PR ld/20828
	* testsuite/ld-elf/pr20828-1.sd: Remove test.
	* testsuite/ld-elf/pr20828-a.sd: New test.
	* testsuite/ld-elf/pr20828-2a.sd: Rename test to...
	* testsuite/ld-elf/pr20828-b.sd: ... this.
	* testsuite/ld-elf/pr20828-2b.sd: Rename test to...
	* testsuite/ld-elf/pr20828-c.sd: ... this.
	* testsuite/ld-elf/shared.exp: Adjust accordingly.
---
 This also prepares for 2/5, which will reverse the ordering in the symbol 
table of the entries being checked for, for some reason I didn't bother 
investigating as irrelevant to PR ld/20828.

 Committed as obvious, and backported to 2.28.

  Maciej

binutils-bfd-elf-link-assignment-forced-local-test-symbol-order.diff
Index: binutils/ld/testsuite/ld-elf/pr20828-1.sd
===================================================================
--- binutils.orig/ld/testsuite/ld-elf/pr20828-1.sd	2017-01-20 20:41:09.442398616 +0000
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,12 +0,0 @@
-# Make sure symbols are global rather than local in the dynamic symbol table,
-# e.g.:
-#    Num:    Value  Size Type    Bind   Vis      Ndx Name
-#      1: 00000000     0 NOTYPE  GLOBAL DEFAULT    1 _fdata
-#      2: 00000000     0 NOTYPE  GLOBAL DEFAULT    1 _edata
-# vs:
-#      1: 00000000     0 NOTYPE  LOCAL  DEFAULT    1 _fdata
-#      2: 00000000     0 NOTYPE  LOCAL  DEFAULT    1 _edata
-#...
- *[0-9]+: +[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_fdata
- *[0-9]+: +[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_edata
-#pass
Index: binutils/ld/testsuite/ld-elf/pr20828-2a.sd
===================================================================
--- binutils.orig/ld/testsuite/ld-elf/pr20828-2a.sd	2017-01-20 20:41:09.465784341 +0000
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,9 +0,0 @@
-# Make sure `_edata' is global rather than local in the dynamic symbol table,
-# e.g.:
-#    Num:    Value  Size Type    Bind   Vis      Ndx Name
-#      1: 00000000     0 NOTYPE  GLOBAL DEFAULT    1 _edata
-# vs:
-#      1: 00000000     0 NOTYPE  LOCAL  DEFAULT    1 _edata
-#...
- *[0-9]+: +[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_edata
-#pass
Index: binutils/ld/testsuite/ld-elf/pr20828-2b.sd
===================================================================
--- binutils.orig/ld/testsuite/ld-elf/pr20828-2b.sd	2017-01-20 20:41:09.480896080 +0000
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,7 +0,0 @@
-# Make sure no `_fdata' is present in the dynamic symbol table, e.g.:
-#    Num:    Value  Size Type    Bind   Vis      Ndx Name
-#      1: 00000000     0 NOTYPE  LOCAL  DEFAULT    1 _fdata
-#failif
-#...
-.+ +_fdata
-#pass
Index: binutils/ld/testsuite/ld-elf/pr20828-a.sd
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils/ld/testsuite/ld-elf/pr20828-a.sd	2017-01-20 20:43:42.680046124 +0000
@@ -0,0 +1,9 @@
+# Make sure `_fdata' is global rather than local in the dynamic symbol table,
+# e.g.:
+#    Num:    Value  Size Type    Bind   Vis      Ndx Name
+#      1: 00000000     0 NOTYPE  GLOBAL DEFAULT    1 _fdata
+# vs:
+#      1: 00000000     0 NOTYPE  LOCAL  DEFAULT    1 _fdata
+#...
+ *[0-9]+: +[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_fdata
+#pass
Index: binutils/ld/testsuite/ld-elf/pr20828-b.sd
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils/ld/testsuite/ld-elf/pr20828-b.sd	2017-01-20 20:43:42.685227876 +0000
@@ -0,0 +1,9 @@
+# Make sure `_edata' is global rather than local in the dynamic symbol table,
+# e.g.:
+#    Num:    Value  Size Type    Bind   Vis      Ndx Name
+#      1: 00000000     0 NOTYPE  GLOBAL DEFAULT    1 _edata
+# vs:
+#      1: 00000000     0 NOTYPE  LOCAL  DEFAULT    1 _edata
+#...
+ *[0-9]+: +[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_edata
+#pass
Index: binutils/ld/testsuite/ld-elf/pr20828-c.sd
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils/ld/testsuite/ld-elf/pr20828-c.sd	2017-01-20 20:43:42.706662600 +0000
@@ -0,0 +1,7 @@
+# Make sure no `_fdata' is present in the dynamic symbol table, e.g.:
+#    Num:    Value  Size Type    Bind   Vis      Ndx Name
+#      1: 00000000     0 NOTYPE  LOCAL  DEFAULT    1 _fdata
+#failif
+#...
+.+ +_fdata
+#pass
Index: binutils/ld/testsuite/ld-elf/shared.exp
===================================================================
--- binutils.orig/ld/testsuite/ld-elf/shared.exp	2017-01-20 20:41:09.524308704 +0000
+++ binutils/ld/testsuite/ld-elf/shared.exp	2017-01-20 20:43:42.740061346 +0000
@@ -57,14 +57,16 @@ if { [check_gc_sections_available] } {
 	      (auxiliary shared library)" \
 	     "$LFLAGS -shared --gc-sections -T pr20828.ld" "" "$AFLAGS_PIC" \
 	     {pr20828.s} \
-	     {{readelf --dyn-syms pr20828-1.sd}} \
+	     {{readelf --dyn-syms pr20828-a.sd} \
+	      {readelf --dyn-syms pr20828-b.sd}} \
 	     "libpr20828.so"] \
 	[list \
 	    "PR ld/20828 dynamic symbols with section GC (plain)" \
 	     "$LFLAGS -shared --gc-sections -T pr20828.ld" \
 	     "tmpdir/libpr20828.so" "$AFLAGS_PIC" \
 	     {pr20828.s} \
-	     {{readelf --dyn-syms pr20828-1.sd}} \
+	     {{readelf --dyn-syms pr20828-a.sd} \
+	      {readelf --dyn-syms pr20828-b.sd}} \
 	     "pr20828-1.so"] \
 	[list \
 	    "PR ld/20828 dynamic symbols with section GC (version script)" \
@@ -73,8 +75,8 @@ if { [check_gc_sections_available] } {
 	     "tmpdir/libpr20828.so" \
 	     "$AFLAGS_PIC" \
 	     {pr20828.s} \
-	     {{readelf --dyn-syms pr20828-2a.sd} \
-	      {readelf --dyn-syms pr20828-2b.sd}} \
+	     {{readelf --dyn-syms pr20828-b.sd} \
+	      {readelf --dyn-syms pr20828-c.sd}} \
 	     "pr20828-2.so"]]
 }
 



More information about the Binutils mailing list