This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] LD/ELF: Unify STB_GNU_UNIQUE handling
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: Matthew Fortune <Matthew dot Fortune at imgtec dot com>, Pedro Alves <palves at redhat dot com>, Richard Earnshaw <rearnsha at arm dot com>, Marcus Shawcroft <marcus dot shawcroft at arm dot com>, Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>, <binutils at sourceware dot org>
- Date: Mon, 16 May 2016 08:51:26 +0100
- Subject: [PATCH] LD/ELF: Unify STB_GNU_UNIQUE handling
- Authentication-results: sourceware.org; auth=none
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.
---
This has passed regression testing over my usual targets, 157 at the
moment, with a couple newly added for correct coverage. This is the list
of failures removed with this change:
alpha-unknown-freebsd4.7 -ERROR: .../binutils/testsuite/binutils-all/unique.s: assembly failed
m68hc12-elf -FAIL: strip on STB_GNU_UNIQUE
mips-freebsd -ERROR: .../binutils/testsuite/binutils-all/unique.s: assembly failed
mips64-freebsd -ERROR: .../binutils/testsuite/binutils-all/unique.s: assembly failed
mips64el-freebsd -ERROR: .../binutils/testsuite/binutils-all/unique.s: assembly failed
mipsel-freebsd -ERROR: .../binutils/testsuite/binutils-all/unique.s: assembly failed
NB ARM/ELF targets, both 32-bit and 64-bit, continue to fail building
(cf. <https://sourceware.org/ml/binutils/2016-04/msg00474.html>), but this
change causes no regression there, so I'm leaving it up to ARM maintainers
to validate this change once the build breakage has been addressed.
The few ELF targets which have been excluded from testing due to the use
of `_bfd_generic_final_link' trigger an assertion failure like this:
./ld-new: BFD (GNU Binutils) 2.26.51.20160514 internal error, aborting at .../bfd/linker.c:2244 in _bfd_generic_link_output_symbols
./ld-new: Please report this bug.
While I don't think there's a need or indeed a way to add STB_GNU_UNIQUE
support to `_bfd_generic_link_output_symbols', I think it would be good to
fail gracefully, or perhaps better yet convert the affected targets so
that they use `bfd_elf_final_link' instead. This is material for separate
consideration though.
Given the above, OK to apply?
Maciej
binutils-ld-stb-gnu-unique.diff
bfd/elf-s390-common.c | 5 +--
bfd/elf32-arc.c | 5 +--
bfd/elf32-arm.c | 5 +--
bfd/elf32-i386.c | 25 -----------------
bfd/elf32-m68k.c | 5 +--
bfd/elf32-ppc.c | 5 +--
bfd/elf32-sparc.c | 5 +--
bfd/elf64-ppc.c | 5 +--
bfd/elf64-sparc.c | 5 +--
bfd/elf64-x86-64.c | 8 -----
bfd/elflink.c | 5 +++
bfd/elfxx-aarch64.c | 5 +--
bfd/elfxx-mips.c | 5 ---
binutils/testsuite/binutils-all/objcopy.exp | 7 +---
binutils/testsuite/lib/binutils-common.exp | 40 ++++++++++++++++++++++++++++
ld/testsuite/ld-unique/unique.exp | 21 ++++----------
16 files changed, 73 insertions(+), 83 deletions(-)
Index: binutils/bfd/elf-s390-common.c
===================================================================
--- binutils.orig/bfd/elf-s390-common.c 2016-05-16 01:07:13.542148707 +0100
+++ binutils/bfd/elf-s390-common.c 2016-05-16 04:53:31.130106400 +0100
@@ -236,11 +236,10 @@ elf_s390_add_symbol_hook (bfd *abfd,
asection **secp ATTRIBUTE_UNUSED,
bfd_vma *valp ATTRIBUTE_UNUSED)
{
- if ((ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
- || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
+ if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
+ elf_tdata (info->output_bfd)->has_gnu_symbols |= elf_gnu_symbol_ifunc;
return TRUE;
}
Index: binutils/bfd/elf32-arc.c
===================================================================
--- binutils.orig/bfd/elf32-arc.c 2016-05-16 01:07:13.560362069 +0100
+++ binutils/bfd/elf32-arc.c 2016-05-16 04:53:31.366260130 +0100
@@ -2742,11 +2742,10 @@ elf_arc_add_symbol_hook (bfd * abfd,
asection ** secp ATTRIBUTE_UNUSED,
bfd_vma * valp ATTRIBUTE_UNUSED)
{
- if ((ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
- || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
+ if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
+ elf_tdata (info->output_bfd)->has_gnu_symbols |= elf_gnu_symbol_ifunc;
return TRUE;
}
Index: binutils/bfd/elf32-arm.c
===================================================================
--- binutils.orig/bfd/elf32-arm.c 2016-05-16 01:07:13.574593900 +0100
+++ binutils/bfd/elf32-arm.c 2016-05-16 04:53:31.852595052 +0100
@@ -17725,11 +17725,10 @@ elf32_arm_add_symbol_hook (bfd *abfd, st
Elf_Internal_Sym *sym, const char **namep,
flagword *flagsp, asection **secp, bfd_vma *valp)
{
- if ((ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
- || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
+ if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
+ elf_tdata (info->output_bfd)->has_gnu_symbols |= elf_gnu_symbol_ifunc;
if (elf32_arm_hash_table (info) == NULL)
return FALSE;
Index: binutils/bfd/elf32-i386.c
===================================================================
--- binutils.orig/bfd/elf32-i386.c 2016-05-16 01:07:13.586768015 +0100
+++ binutils/bfd/elf32-i386.c 2016-05-16 04:53:32.112699380 +0100
@@ -5795,27 +5795,6 @@ elf_i386_hash_symbol (struct elf_link_ha
return _bfd_elf_hash_symbol (h);
}
-/* Hook called by the linker routine which adds symbols from an object
- file. */
-
-static bfd_boolean
-elf_i386_add_symbol_hook (bfd * abfd,
- struct bfd_link_info * info,
- Elf_Internal_Sym * sym,
- const char ** namep ATTRIBUTE_UNUSED,
- flagword * flagsp ATTRIBUTE_UNUSED,
- asection ** secp ATTRIBUTE_UNUSED,
- bfd_vma * valp ATTRIBUTE_UNUSED)
-{
- if (ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE
- && (abfd->flags & DYNAMIC) == 0
- && bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols
- |= elf_gnu_symbol_unique;
-
- return TRUE;
-}
-
#define TARGET_LITTLE_SYM i386_elf32_vec
#define TARGET_LITTLE_NAME "elf32-i386"
#define ELF_ARCH bfd_arch_i386
@@ -5863,7 +5842,6 @@ elf_i386_add_symbol_hook (bfd * abfd,
#define elf_backend_omit_section_dynsym \
((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
#define elf_backend_hash_symbol elf_i386_hash_symbol
-#define elf_backend_add_symbol_hook elf_i386_add_symbol_hook
#define elf_backend_fixup_symbol elf_i386_fixup_symbol
#include "elf32-target.h"
@@ -6053,9 +6031,6 @@ elf32_iamcu_elf_object_p (bfd *abfd)
#undef elf_backend_strtab_flags
#undef elf_backend_copy_special_section_fields
-#undef elf_backend_add_symbol_hook
-#define elf_backend_add_symbol_hook elf_i386_add_symbol_hook
-
#include "elf32-target.h"
/* Restore defaults. */
Index: binutils/bfd/elf32-m68k.c
===================================================================
--- binutils.orig/bfd/elf32-m68k.c 2016-05-16 01:07:13.597932167 +0100
+++ binutils/bfd/elf32-m68k.c 2016-05-16 04:53:32.464771301 +0100
@@ -4839,11 +4839,10 @@ elf_m68k_add_symbol_hook (bfd *abfd,
asection **secp ATTRIBUTE_UNUSED,
bfd_vma *valp ATTRIBUTE_UNUSED)
{
- if ((ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
- || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
+ if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
+ elf_tdata (info->output_bfd)->has_gnu_symbols |= elf_gnu_symbol_ifunc;
return TRUE;
}
Index: binutils/bfd/elf32-ppc.c
===================================================================
--- binutils.orig/bfd/elf32-ppc.c 2016-05-16 01:07:13.607009585 +0100
+++ binutils/bfd/elf32-ppc.c 2016-05-16 04:53:32.879412669 +0100
@@ -3674,11 +3674,10 @@ ppc_elf_add_symbol_hook (bfd *abfd,
*valp = sym->st_size;
}
- if ((ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
- || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
+ if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
+ elf_tdata (info->output_bfd)->has_gnu_symbols |= elf_gnu_symbol_ifunc;
return TRUE;
}
Index: binutils/bfd/elf32-sparc.c
===================================================================
--- binutils.orig/bfd/elf32-sparc.c 2016-05-16 01:07:13.620457258 +0100
+++ binutils/bfd/elf32-sparc.c 2016-05-16 04:53:33.081355257 +0100
@@ -180,11 +180,10 @@ elf32_sparc_add_symbol_hook (bfd * abfd,
asection ** secp ATTRIBUTE_UNUSED,
bfd_vma * valp ATTRIBUTE_UNUSED)
{
- if ((ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
- || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
+ if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
+ elf_tdata (info->output_bfd)->has_gnu_symbols |= elf_gnu_symbol_ifunc;
return TRUE;
}
Index: binutils/bfd/elf64-ppc.c
===================================================================
--- binutils.orig/bfd/elf64-ppc.c 2016-05-16 01:07:13.637593949 +0100
+++ binutils/bfd/elf64-ppc.c 2016-05-16 04:53:33.811423753 +0100
@@ -4894,11 +4894,10 @@ ppc64_elf_add_symbol_hook (bfd *ibfd,
asection **sec,
bfd_vma *value)
{
- if ((ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC
- || ELF_ST_BIND (isym->st_info) == STB_GNU_UNIQUE)
+ if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC
&& (ibfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
+ elf_tdata (info->output_bfd)->has_gnu_symbols |= elf_gnu_symbol_ifunc;
if (*sec != NULL
&& strcmp ((*sec)->name, ".opd") == 0)
Index: binutils/bfd/elf64-sparc.c
===================================================================
--- binutils.orig/bfd/elf64-sparc.c 2016-05-16 01:07:13.648810045 +0100
+++ binutils/bfd/elf64-sparc.c 2016-05-16 04:53:34.038364950 +0100
@@ -426,11 +426,10 @@ elf64_sparc_add_symbol_hook (bfd *abfd,
{
static const char *const stt_types[] = { "NOTYPE", "OBJECT", "FUNCTION" };
- if ((ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
- || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
+ if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
+ elf_tdata (info->output_bfd)->has_gnu_symbols |= elf_gnu_symbol_ifunc;
if (ELF_ST_TYPE (sym->st_info) == STT_REGISTER)
{
Index: binutils/bfd/elf64-x86-64.c
===================================================================
--- binutils.orig/bfd/elf64-x86-64.c 2016-05-16 01:07:13.668058274 +0100
+++ binutils/bfd/elf64-x86-64.c 2016-05-16 04:53:35.328148189 +0100
@@ -6277,7 +6277,7 @@ elf_x86_64_section_from_shdr (bfd *abfd,
static bfd_boolean
elf_x86_64_add_symbol_hook (bfd *abfd,
- struct bfd_link_info *info,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
Elf_Internal_Sym *sym,
const char **namep ATTRIBUTE_UNUSED,
flagword *flagsp ATTRIBUTE_UNUSED,
@@ -6306,12 +6306,6 @@ elf_x86_64_add_symbol_hook (bfd *abfd,
return TRUE;
}
- if (ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE
- && (abfd->flags & DYNAMIC) == 0
- && bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols
- |= elf_gnu_symbol_unique;
-
return TRUE;
}
Index: binutils/bfd/elflink.c
===================================================================
--- binutils.orig/bfd/elflink.c 2016-05-16 01:07:13.680348951 +0100
+++ binutils/bfd/elflink.c 2016-05-16 04:53:35.912986914 +0100
@@ -4380,6 +4380,11 @@ elf_link_add_object_symbols (bfd *abfd,
(struct bfd_link_hash_entry **) sym_hash)))
goto error_free_vers;
+ if ((flags & BSF_GNU_UNIQUE)
+ && (abfd->flags & DYNAMIC) == 0
+ && bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
+ elf_tdata (info->output_bfd)->has_gnu_symbols |= elf_gnu_symbol_unique;
+
h = *sym_hash;
/* We need to make sure that indirect symbol dynamic flags are
updated. */
Index: binutils/bfd/elfxx-aarch64.c
===================================================================
--- binutils.orig/bfd/elfxx-aarch64.c 2016-05-16 01:07:13.695552515 +0100
+++ binutils/bfd/elfxx-aarch64.c 2016-05-16 04:53:36.131904239 +0100
@@ -538,11 +538,10 @@ _bfd_aarch64_elf_add_symbol_hook (bfd *a
asection **secp ATTRIBUTE_UNUSED,
bfd_vma *valp ATTRIBUTE_UNUSED)
{
- if ((ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
- || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
+ if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
+ elf_tdata (info->output_bfd)->has_gnu_symbols |= elf_gnu_symbol_ifunc;
return TRUE;
}
Index: binutils/bfd/elfxx-mips.c
===================================================================
--- binutils.orig/bfd/elfxx-mips.c 2016-05-16 01:07:13.701683174 +0100
+++ binutils/bfd/elfxx-mips.c 2016-05-16 04:53:36.738338286 +0100
@@ -7526,11 +7526,6 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd
mips_elf_hash_table (info)->rld_symbol = h;
}
- if (ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE
- && (abfd->flags & DYNAMIC) == 0
- && bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols |= elf_gnu_symbol_unique;
-
/* If this is a mips16 text symbol, add 1 to the value to make it
odd. This will cause something like .word SYM to come up with
the right value when it is loaded into the PC. */
Index: binutils/binutils/testsuite/binutils-all/objcopy.exp
===================================================================
--- binutils.orig/binutils/testsuite/binutils-all/objcopy.exp 2016-05-16 08:21:18.420623062 +0100
+++ binutils/binutils/testsuite/binutils-all/objcopy.exp 2016-05-16 08:21:29.128878365 +0100
@@ -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 ""
Index: binutils/binutils/testsuite/lib/binutils-common.exp
===================================================================
--- binutils.orig/binutils/testsuite/lib/binutils-common.exp 2016-05-16 08:21:18.515958237 +0100
+++ binutils/binutils/testsuite/lib/binutils-common.exp 2016-05-16 08:33:08.736128225 +0100
@@ -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.
#
Index: binutils/ld/testsuite/ld-unique/unique.exp
===================================================================
--- binutils.orig/ld/testsuite/ld-unique/unique.exp 2016-05-16 08:21:18.627688679 +0100
+++ binutils/ld/testsuite/ld-unique/unique.exp 2016-05-16 08:21:29.191258437 +0100
@@ -24,20 +24,13 @@
# Adapted for unique checking by Mark J. Wielaard <mjw@redhat.com>
-# STB_GNU_UNIQUE support has only been implemented for the ix86, x86_64,
-# arm, mips, powerpc, and sparc so far.
-if {!(([istarget "i?86-*-*"]
- || [istarget "x86_64-*-*"]
- || [istarget "arm*-*-*"]
- || [istarget "mips*-*-*"]
- || [istarget "powerpc*-*-*"]
- || [istarget "sparc*-*-*"])
- && ([istarget "*-*-elf*"]
- || [istarget "*-*-nacl*"]
- || (([istarget "*-*-linux*"]
- || [istarget "*-*-gnu*"])
- && ![istarget "*-*-*aout*"]
- && ![istarget "*-*-*oldld*"]))) } {
+# Exclude non-ELF targets.
+if { ![is_elf_format] } {
+ return
+}
+
+# Require STB_GNU_UNIQUE support with OSABI set to GNU.
+if { ![supports_gnu_unique] } {
verbose "UNIQUE tests not run - target does not support UNIQUE"
return
}