From: Rainer Orth Date: Sat, 24 Jan 2026 07:02:14 +0000 (+0100) Subject: ld: testsuite: Skip pr33577 tests with GNU extensions on Solaris [PR33577] X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87997f8b4f5d348557fba410c966bd72d3670c1a;p=thirdparty%2Fbinutils-gdb.git ld: testsuite: Skip pr33577 tests with GNU extensions on Solaris [PR33577] Several of the ld-elfvers pr33577 tests FAIL on Solaris, for either or both of two reasons: * Tests using ld --hash-style=gnu cannot work on Solaris: .gnu.hash/SHT_GNU_HASH sections are a GNU extension not supported by Solaris ld.so.1. * Similarly, binding different implementations of the same symbol to different symbol versions is a GNU extension that wasn't in the original Solaris specification of symbol versioning. ld.so.1 doesn't support it and never will. This can be seen in the elfdump output for the .dynsym section: Symbol Table Section: .dynsym index value size type bind oth ver shndx name [8] 0x630 0xd FUNC GLOB D 1H .text foo [10] 0x620 0x6 FUNC GLOB D 2 .text foo foo is bound to both version 1 (the Base version) and version 2 (VERS_1 from pr33577.map). Same for .symtab: Symbol Table Section: .symtab index value size type bind oth ver shndx name [28] 0x620 0x6 FUNC GLOB D 0 .text foo [35] 0x630 0xd FUNC GLOB D 0 .text foo@ As I said, ld.so.1 doesn't support @ (in this case the Base version) at all. Therefore the tests that employ those extensions are guarded with supports_gnu_osabi. Tested on sparc{,v9}-sun-solaris2.11, sparc{,64}-unknown-linux-gnu, {i386,amd64}-pc-solaris2.11, and {x86_64,i686}-pc-linux-gnu. 2026-01-23 Rainer Orth ld: PR ld/33577 * testsuite/ld-elfvers/vers.exp (base_symbol_test): Only run pr33577a with libpr33577-versioned.so test on ELFOSABI_GNU systems. Likewise for run base_symbol_tests with --hash-style=gnu. --- diff --git a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/vers.exp index 0c781855cad..78cc08a9fc8 100644 --- a/ld/testsuite/ld-elfvers/vers.exp +++ b/ld/testsuite/ld-elfvers/vers.exp @@ -1092,7 +1092,9 @@ proc base_symbol_test { ldflags } { ] \ ] - if [isnative] { + # Binding different implementations of the same symbol to different + # versions is a GNU extension. + if { [isnative] && [supports_gnu_osabi] } { set test_name "Run pr33577a with tmpdir/libpr33577-versioned.so ($ldflags)" set cmd tmpdir/pr33577a send_log "$cmd\n" @@ -1104,6 +1106,9 @@ proc base_symbol_test { ldflags } { fail "$test_name" } + } + + if [isnative] { set test_name "Run pr33577b with tmpdir/libpr33577-versioned.so ($ldflags)" set cmd tmpdir/pr33577b send_log "$cmd\n" @@ -1118,8 +1123,12 @@ proc base_symbol_test { ldflags } { } base_symbol_test "-Wl,--as-needed,--hash-style=sysv" -base_symbol_test "-Wl,--as-needed,--hash-style=gnu" base_symbol_test "-Wl,--as-needed,--hash-style=both" base_symbol_test "-Wl,--no-as-needed,--hash-style=sysv" -base_symbol_test "-Wl,--no-as-needed,--hash-style=gnu" base_symbol_test "-Wl,--no-as-needed,--hash-style=both" + +# Only run tests using .gnu.hash when GNU extensions are supported +if [supports_gnu_osabi] { + base_symbol_test "-Wl,--as-needed,--hash-style=gnu" + base_symbol_test "-Wl,--no-as-needed,--hash-style=gnu" +}