This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[committed 2/5] PR ld/20828: Remove leading `_' from symbols used in tests
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: Nick Clifton <nickc at redhat dot com>, Alan Modra <amodra at gmail dot com>, James Cowgill <James dot Cowgill at imgtec dot com>
- Cc: "Maciej W. Rozycki" <macro at linux-mips dot org>, <binutils at sourceware dot org>
- Date: Mon, 23 Jan 2017 11:35:40 +0000
- Subject: [committed 2/5] PR ld/20828: Remove leading `_' from symbols used in tests
- Authentication-results: sourceware.org; auth=none
- References: <bug-20828-70@http.sourceware.org/bugzilla/> <bug-20828-70-QMcZ2LkAaY@http.sourceware.org/bugzilla/> <e6ca2026-eead-8e4a-b99b-dba27c41ac0d@redhat.com> <alpine.DEB.2.00.1701191811170.6936@tp.orcam.me.uk> <alpine.DEB.2.00.1701202112480.6936@tp.orcam.me.uk>
Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols
wrongly forced local with section GC") and remove the leading underscore
from `_fdata' and `_edata' symbols used in tests, fixing a:
FAIL: PR ld/20828 dynamic symbols with section GC (version script)
failure with targets such as: `bfin-elf', `bfin-uclinux', `metag-elf',
`metag-linux' `mn10300-elf', `sh-elf', `sh64-elf', and possibly other
ones, that have `_' set (with `elf_symbol_leading_char') as the leading
character for symbols. As from commit 93252b1cf41a ("bfd/ld: handle ABI
prefixes in version scripts") these targets strip the leading underscore
before applying version script rules, because the (default) syntax for
symbol names is that of the C language rather than their low-level
symbol table encoding.
ld/
PR ld/20828
* testsuite/ld-elf/pr20828.ld: Rename `_fdata' and `_edata' to
`fdata' and `edata' respectively.
* testsuite/ld-elf/pr20828.ver: Adjust accordingly.
* testsuite/ld-elf/pr20828-a.sd: Likewise.
* testsuite/ld-elf/pr20828-b.sd: Likewise.
* testsuite/ld-elf/pr20828-c.sd: Likewise.
---
NB this change makes `edata' appear before `fdata' in symbol tables,
which is unlike `_fdata' vs `_edata', however 1/5 has already made tests
not depend on entry ordering. No regressions with other targets.
Committed as obvious, and backported to 2.28.
As a side note, perhaps we might want to support a `raw' or suchlike
version script entry encoding one day so that we can handle prefixed and
unprefixed symbols separately, e.g. if say `_edata' and `edata' were
present both at a time and required to have a different scope or version
tag each.
Maciej
binutils-bfd-elf-link-assignment-forced-local-test-symbol-leading-char.diff
Index: binutils/ld/testsuite/ld-elf/pr20828-a.sd
===================================================================
--- binutils.orig/ld/testsuite/ld-elf/pr20828-a.sd 2017-01-20 20:43:42.000000000 +0000
+++ binutils/ld/testsuite/ld-elf/pr20828-a.sd 2017-01-20 20:39:54.878920000 +0000
@@ -1,9 +1,9 @@
-# Make sure `_fdata' is global rather than local in the dynamic symbol table,
+# 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
+# 1: 00000000 0 NOTYPE GLOBAL DEFAULT 1 fdata
# vs:
-# 1: 00000000 0 NOTYPE LOCAL DEFAULT 1 _fdata
+# 1: 00000000 0 NOTYPE LOCAL DEFAULT 1 fdata
#...
- *[0-9]+: +[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_fdata
+ *[0-9]+: +[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +fdata
#pass
Index: binutils/ld/testsuite/ld-elf/pr20828-b.sd
===================================================================
--- binutils.orig/ld/testsuite/ld-elf/pr20828-b.sd 2017-01-20 20:43:42.000000000 +0000
+++ binutils/ld/testsuite/ld-elf/pr20828-b.sd 2017-01-20 20:39:54.896117000 +0000
@@ -1,9 +1,9 @@
-# Make sure `_edata' is global rather than local in the dynamic symbol table,
+# 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
+# 1: 00000000 0 NOTYPE GLOBAL DEFAULT 1 edata
# vs:
-# 1: 00000000 0 NOTYPE LOCAL DEFAULT 1 _edata
+# 1: 00000000 0 NOTYPE LOCAL DEFAULT 1 edata
#...
- *[0-9]+: +[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_edata
+ *[0-9]+: +[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +edata
#pass
Index: binutils/ld/testsuite/ld-elf/pr20828-c.sd
===================================================================
--- binutils.orig/ld/testsuite/ld-elf/pr20828-c.sd 2017-01-20 20:43:42.000000000 +0000
+++ binutils/ld/testsuite/ld-elf/pr20828-c.sd 2017-01-20 20:39:54.908304000 +0000
@@ -1,7 +1,7 @@
-# Make sure no `_fdata' is present in the dynamic symbol table, e.g.:
+# 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
+# 1: 00000000 0 NOTYPE LOCAL DEFAULT 1 fdata
#failif
#...
-.+ +_fdata
+.+ +fdata
#pass
Index: binutils/ld/testsuite/ld-elf/pr20828.ld
===================================================================
--- binutils.orig/ld/testsuite/ld-elf/pr20828.ld 2017-01-20 20:43:42.000000000 +0000
+++ binutils/ld/testsuite/ld-elf/pr20828.ld 2017-01-20 20:45:37.648329567 +0000
@@ -2,9 +2,9 @@ SECTIONS
{
.data :
{
- _fdata = .;
+ fdata = .;
*(.data)
- _edata = .;
+ edata = .;
}
.dynamic : { *(.dynamic) }
.hash : { *(.hash) }
Index: binutils/ld/testsuite/ld-elf/pr20828.ver
===================================================================
--- binutils.orig/ld/testsuite/ld-elf/pr20828.ver 2017-01-20 20:43:42.000000000 +0000
+++ binutils/ld/testsuite/ld-elf/pr20828.ver 2017-01-20 20:45:37.659399218 +0000
@@ -1 +1 @@
-{ global: _edata; local: *; };
+{ global: edata; local: *; };