This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] LD: Fix .startof.SECNAME/.sizeof.SECNAME tests for MIPS/IRIX
- From: Maciej W.Rozycki <macro at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 26 Jun 2017 15:17:50 -0000
- Subject: [binutils-gdb] LD: Fix .startof.SECNAME/.sizeof.SECNAME tests for MIPS/IRIX
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=515a4464176efc6ac31c83bd40b5c67f61c3b044
commit 515a4464176efc6ac31c83bd40b5c67f61c3b044
Author: Maciej W. Rozycki <macro@imgtec.com>
Date: Mon Jun 26 16:08:55 2017 +0100
LD: Fix .startof.SECNAME/.sizeof.SECNAME tests for MIPS/IRIX
Correct .startof.SECNAME/.sizeof.SECNAME tests for MIPS/IRIX targets,
complementing commit dc74becf498f ("ld: Add tests for -Ur") and commit
da614360f520 ("ld: Add tests for .startof.SECNAME/.sizeof.SECNAME") with
subsequent updates, and in reference to commit cbd0eecf261c ("Always
define referenced __start_SECNAME/__stop_SECNAME") and commit
7dba9362c172 ("Rewrite __start and __stop symbol handling").
These targets set the STT_OBJECT type for non-function symbol
references, according to `elf_frob_symbol' code in gas/config/obj-elf.c:
/* The Irix 5 and 6 assemblers set the type of any common symbol and
any undefined non-function symbol to STT_OBJECT. We try to be
compatible, since newer Irix 5 and 6 linkers care. However, we
only set undefined symbols to be STT_OBJECT if we are on Irix,
because that is the only time gcc will generate the necessary
.global directives to mark functions. */
if (S_IS_COMMON (symp))
symbol_get_bfdsym (symp)->flags |= BSF_OBJECT;
if (strstr (TARGET_OS, "irix") != NULL
&& ! S_IS_DEFINED (symp)
&& (symbol_get_bfdsym (symp)->flags & BSF_FUNCTION) == 0)
symbol_get_bfdsym (symp)->flags |= BSF_OBJECT;
and consequently entries in the symbol table listing from `readelf'
produced with these tests do not match the NOTYPE pattern expected,
causing test suite failures:
FAIL: ld-elf/sizeofa
FAIL: ld-elf/sizeofc
FAIL: ld-elf/startofa
FAIL: ld-elf/startofc
specifically with the `mips-sgi-irix5' and `mips-sgi-irix6' targets.
Given that it does not matter for the feature covered by these tests
whether the type of the symbols produced is STT_NOTYPE or STT_OBJECT
adjust the problematic cases to accept either type, removing the
failures observed.
ld/
* testsuite/ld-elf/sizeofa.d: Also accept the OBJECT type for
the symbols examined.
* testsuite/ld-elf/sizeofc.d: Likewise.
* testsuite/ld-elf/startofa.d: Likewise.
* testsuite/ld-elf/startofc.d: Likewise.
Diff:
---
bfd/ChangeLog | 2 ++
ld/ChangeLog | 8 ++++++++
ld/testsuite/ld-elf/sizeofa.d | 4 ++--
ld/testsuite/ld-elf/sizeofc.d | 4 ++--
ld/testsuite/ld-elf/startofa.d | 4 ++--
ld/testsuite/ld-elf/startofc.d | 4 ++--
6 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 6cf71c3..ee926c6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,5 @@
+2017-06-26 Maciej W. Rozycki <macro@imgtec.com>
+
2017-06-26 Nick Clifton <nickc@redhat.com>
PR binutils/21670
diff --git a/ld/ChangeLog b/ld/ChangeLog
index f85daf4..9b16d43 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2017-06-26 Maciej W. Rozycki <macro@imgtec.com>
+
+ * testsuite/ld-elf/sizeofa.d: Also accept the OBJECT type for
+ the symbols examined.
+ * testsuite/ld-elf/sizeofc.d: Likewise.
+ * testsuite/ld-elf/startofa.d: Likewise.
+ * testsuite/ld-elf/startofc.d: Likewise.
+
2017-06-26 Alan Modra <amodra@gmail.com>
* emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Skip
diff --git a/ld/testsuite/ld-elf/sizeofa.d b/ld/testsuite/ld-elf/sizeofa.d
index fc64cf5..572ffbd 100644
--- a/ld/testsuite/ld-elf/sizeofa.d
+++ b/ld/testsuite/ld-elf/sizeofa.d
@@ -6,7 +6,7 @@ Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
+0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
#...
- +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +(LOC|GLOB)AL +DEFAULT +[0-9]+ +___?stop_scnfoo
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +(LOC|GLOB)AL +DEFAULT +[0-9]+ +___?stop_scnfoo
#...
- +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +.sizeof.scnfoo
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND +.sizeof.scnfoo
#pass
diff --git a/ld/testsuite/ld-elf/sizeofc.d b/ld/testsuite/ld-elf/sizeofc.d
index 219caad..5078741 100644
--- a/ld/testsuite/ld-elf/sizeofc.d
+++ b/ld/testsuite/ld-elf/sizeofc.d
@@ -6,7 +6,7 @@ Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
+0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
#...
- +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +___?stop_scnfoo
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND +___?stop_scnfoo
#...
- +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +.sizeof.scnfoo
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND +.sizeof.scnfoo
#pass
diff --git a/ld/testsuite/ld-elf/startofa.d b/ld/testsuite/ld-elf/startofa.d
index b0bf95b..07d5dda 100644
--- a/ld/testsuite/ld-elf/startofa.d
+++ b/ld/testsuite/ld-elf/startofa.d
@@ -6,7 +6,7 @@ Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
+0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
#...
- +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +(LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo|GLOBAL +DEFAULT +UND +.startof.scnfoo)
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +(LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo|GLOBAL +DEFAULT +UND +.startof.scnfoo)
#...
- +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +(UND +.startof.scnfoo|[0-9]+ +___?start_scnfoo)
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +(UND +.startof.scnfoo|[0-9]+ +___?start_scnfoo)
#pass
diff --git a/ld/testsuite/ld-elf/startofc.d b/ld/testsuite/ld-elf/startofc.d
index 6cde35a..0250892 100644
--- a/ld/testsuite/ld-elf/startofc.d
+++ b/ld/testsuite/ld-elf/startofc.d
@@ -6,7 +6,7 @@ Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
+0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
#...
- +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +.startof.scnfoo
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND +.startof.scnfoo
#...
- +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +___?start_scnfoo
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND +___?start_scnfoo
#pass