aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2016-05-16 08:51:26 +0100
committerMaciej W. Rozycki <macro@imgtec.com>2016-05-17 12:21:40 +0100
commita43942db49b07a457ee4f960d0f118b23641ec38 (patch)
tree8a3c5749955ec8b7fa004c78ed7758d3eb0fde7c /binutils
parentfcdad592cd1f76046c5e4b7a2b0337e146d1e796 (diff)
downloadgdb-a43942db49b07a457ee4f960d0f118b23641ec38.zip
gdb-a43942db49b07a457ee4f960d0f118b23641ec38.tar.gz
gdb-a43942db49b07a457ee4f960d0f118b23641ec38.tar.bz2
LD/ELF: Unify STB_GNU_UNIQUE handling
Take STB_GNU_UNIQUE handling scattered across targets and gather it in the generic ELF linker. Update test suite infrastructure accordingly. bfd/ * elf-s390-common.c (elf_s390_add_symbol_hook): Remove STB_GNU_UNIQUE handling. * elf32-arc.c (elf_arc_add_symbol_hook): Likewise. * elf32-arm.c (elf32_arm_add_symbol_hook): Likewise. * elf32-m68k.c (elf_m68k_add_symbol_hook): Likewise. * elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise. * elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise. * elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise. * elf64-x86-64.c (elf_x86_64_add_symbol_hook): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_add_symbol_hook): Likewise. * elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Likewise. * elf32-i386.c (elf_i386_add_symbol_hook): Remove function. (elf_backend_add_symbol_hook): Remove macro. * elflink.c (elf_link_add_object_symbols): Set `has_gnu_symbols' for STB_GNU_UNIQUE symbols. binutils/ * testsuite/lib/binutils-common.exp (supports_gnu_unique): New procedure. * testsuite/binutils-all/objcopy.exp: Use `supports_gnu_unique' with the `strip-10' test. ld/ * testsuite/ld-unique/unique.exp: Use `is_elf_format' and `supports_gnu_unique' to qualify testing.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog7
-rw-r--r--binutils/testsuite/binutils-all/objcopy.exp7
-rw-r--r--binutils/testsuite/lib/binutils-common.exp40
3 files changed, 49 insertions, 5 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 57802e8..faa9b78 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,10 @@
+2016-05-17 Maciej W. Rozycki <macro@imgtec.com>
+
+ * testsuite/lib/binutils-common.exp (supports_gnu_unique): New
+ procedure.
+ * testsuite/binutils-all/objcopy.exp: Use `supports_gnu_unique'
+ with the `strip-10' test.
+
2016-05-16 Maciej W. Rozycki <macro@imgtec.com>
* testsuite/binutils-all/objcopy.exp: Don't skip the `strip-10'
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index 176764a..af333ac 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -1060,11 +1060,8 @@ if [is_elf_format] {
run_dump_test "strip-8"
run_dump_test "strip-9"
run_dump_test "strip-12"
- # Non-EABI ARM targets will set OSABI to ARM
- if { ![istarget "*-*-hpux*"]
- && ![istarget "msp*-*-*"]
- && ![istarget "visium-*-*"]
- && !([istarget "arm*-*-*"] && ![istarget "arm-*-*eabi*"])} {
+ # This requires STB_GNU_UNIQUE support with OSABI set to GNU.
+ if { [supports_gnu_unique] } {
run_dump_test "strip-10"
}
set extra_strip11 ""
diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 5f17012..33a0382 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -162,6 +162,46 @@ proc is_elf64 { binary_file } {
return 0
}
+# True if the ELF target supports STB_GNU_UNIQUE with the ELF header's
+# OSABI field set to ELFOSABI_GNU.
+#
+# This generally depends on the target OS only, however there are a
+# number of exceptions for bare metal targets as follows. The MSP430
+# and Visium targets set OSABI to ELFOSABI_STANDALONE and cannot
+# support STB_GNU_UNIQUE. Likewise non-EABI ARM targets set OSABI to
+# ELFOSABI_ARM, and TI C6X targets to ELFOSABI_C6000_*. Finally
+# rather than `bfd_elf_final_link' AM33/2.0, D30V, DLX, i960, and
+# picoJava targets use `_bfd_generic_final_link', which does not
+# support STB_GNU_UNIQUE symbol binding causing assertion failures.
+#
+proc supports_gnu_unique {} {
+ if { [istarget *-*-gnu*]
+ || [istarget *-*-linux*]
+ || [istarget *-*-nacl*] } {
+ return 1
+ }
+ if { [istarget "arm*-*-*eabi*"] } {
+ return 1
+ }
+ if { ![istarget "*-*-elf*"] } {
+ return 0
+ }
+ if { [istarget "arm*-*-*"]
+ || [istarget "msp430-*-*"]
+ || [istarget "tic6x-*-*"]
+ || [istarget "visium-*-*"] } {
+ return 0
+ }
+ if { [istarget "am33_2.0-*-*"]
+ || [istarget "d30v-*-*"]
+ || [istarget "dlx-*-*"]
+ || [istarget "i960-*-*"]
+ || [istarget "pj*-*-*"] } {
+ return 0
+ }
+ return 1
+}
+
# Compare two files line-by-line. FILE_1 is the actual output and FILE_2
# is the expected output. Ignore blank lines in either file.
#