[binutils-gdb] ld-elf shared.exp
Alan Modra
amodra@sourceware.org
Thu Sep 10 08:41:54 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fe54f17b832ba93a65bf8ed3a21c851e29e5f8ac
commit fe54f17b832ba93a65bf8ed3a21c851e29e5f8ac
Author: Alan Modra <amodra@gmail.com>
Date: Thu Sep 10 18:05:39 2026 +0930
ld-elf shared.exp
Don't "return" when no CXX, disabling numerous later non-c++ tests.
Enable "Run with libdl3b.so" too.
* testsuite/ld-elf/shared.exp: Properly make c++ tests depend
on CXX_FOR_TARGET. Enable commented out libdl3b.so test,
correcting expected output.
* testsuite/ld-elf/dl3b.out: Delete.
Diff:
---
ld/testsuite/ld-elf/dl3b.out | 1 -
ld/testsuite/ld-elf/shared.exp | 140 ++++++++++++++++++++---------------------
2 files changed, 68 insertions(+), 73 deletions(-)
diff --git a/ld/testsuite/ld-elf/dl3b.out b/ld/testsuite/ld-elf/dl3b.out
deleted file mode 100644
index 8a150441077..00000000000
--- a/ld/testsuite/ld-elf/dl3b.out
+++ /dev/null
@@ -1 +0,0 @@
-BAD2
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index f69a0d402bd..f8b470c65da 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -1333,82 +1333,78 @@ if { [ regexp "undefined reference to `\.?bar'" $exec_output ] } {
fail $testname
}
-# Check to see if the C++ compiler works
-if { [which $CXX_FOR_TARGET] == 0 } {
- return
-}
-
-set build_cxx_tests {
- {"Build libdl3a.so with --dynamic-list=dl3.list"
- "-shared -Wl,--dynamic-list=dl3.list" "-fPIC"
- {dl3.cc} {} "libdl3a.so" "c++"}
- {"Build libdl3b.so with -Bsymbolic"
- "-shared -Wl,-Bsymbolic" "-fPIC"
- {dl3.cc} {} "libdl3b.so" "c++"}
- {"Build libdl3a.so with --dynamic-list-cpp-typeinfo"
- "-shared -Wl,--dynamic-list-cpp-typeinfo" "-fPIC"
- {dl3.cc} {} "libdl3c.so" "c++"}
-}
+if { [which $CXX_FOR_TARGET] != 0 } {
+ set build_cxx_tests {
+ {"Build libdl3a.so with --dynamic-list=dl3.list"
+ "-shared -Wl,--dynamic-list=dl3.list" "-fPIC"
+ {dl3.cc} {} "libdl3a.so" "c++"}
+ {"Build libdl3b.so with -Bsymbolic"
+ "-shared -Wl,-Bsymbolic" "-fPIC"
+ {dl3.cc} {} "libdl3b.so" "c++"}
+ {"Build libdl3a.so with --dynamic-list-cpp-typeinfo"
+ "-shared -Wl,--dynamic-list-cpp-typeinfo" "-fPIC"
+ {dl3.cc} {} "libdl3c.so" "c++"}
+ }
-run_cc_link_tests [list \
- [list \
- "Build libdnew1a.so with --Bsymbolic-functions --dynamic-list-cpp-new" \
- "-shared $NOSANITIZE_CFLAGS -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" \
- "-fPIC -ansi $NOSANITIZE_CFLAGS" \
- {del.cc new.cc} \
- {} \
- "libnew1a.so" \
- "c++" \
- ] \
- [list \
- "Build libdnew1b.so with --dynamic-list-data --dynamic-list-cpp-new" \
- "-shared $NOSANITIZE_CFLAGS -Wl,--dynamic-list-data,--dynamic-list-cpp-new" \
- "-fPIC -ansi $NOSANITIZE_CFLAGS" \
- {del.cc new.cc} \
- {} \
- "libnew1b.so" \
- "c++" \
- ] \
-]
+ run_cc_link_tests [list \
+ [list \
+ "Build libdnew1a.so with --Bsymbolic-functions --dynamic-list-cpp-new" \
+ "-shared $NOSANITIZE_CFLAGS -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" \
+ "-fPIC -ansi $NOSANITIZE_CFLAGS" \
+ {del.cc new.cc} \
+ {} \
+ "libnew1a.so" \
+ "c++" \
+ ] \
+ [list \
+ "Build libdnew1b.so with --dynamic-list-data --dynamic-list-cpp-new" \
+ "-shared $NOSANITIZE_CFLAGS -Wl,--dynamic-list-data,--dynamic-list-cpp-new" \
+ "-fPIC -ansi $NOSANITIZE_CFLAGS" \
+ {del.cc new.cc} \
+ {} \
+ "libnew1b.so" \
+ "c++" \
+ ] \
+ ]
-# "-shared -Bsymbolic" only works with gcc 4.5.0 and newer.
-# {"Run with libdl3b.so"
-# "tmpdir/libdl3b.so" ""
-# {dl3main.cc} "dl3b" "dl3b.out" "" "c++"}
-set run_cxx_tests {
- {"Run with libdl3a.so"
- "-Wl,--no-as-needed tmpdir/libdl3a.so" ""
- {dl3main.cc} "dl3a" "dl3a.out" "" "c++"}
- {"Run with libdl3c.so"
- "-Wl,--no-as-needed tmpdir/libdl3c.so" ""
- {dl3main.cc} "dl3c" "dl3a.out" "" "c++"}
-}
+ set run_cxx_tests {
+ {"Run with libdl3a.so"
+ "-Wl,--no-as-needed tmpdir/libdl3a.so" ""
+ {dl3main.cc} "dl3a" "dl3a.out" "" "c++"}
+ {"Run with libdl3b.so"
+ "tmpdir/libdl3b.so" ""
+ {dl3main.cc} "dl3b" "dl3a.out" "" "c++"}
+ {"Run with libdl3c.so"
+ "-Wl,--no-as-needed tmpdir/libdl3c.so" ""
+ {dl3main.cc} "dl3c" "dl3a.out" "" "c++"}
+ }
-run_ld_link_exec_tests [list \
- [list \
- "Run with libnew1a.so" \
- "-Wl,--no-as-needed tmpdir/libnew1a.so $NOSANITIZE_CFLAGS" \
- "" \
- {dl5.cc} \
- "dl5a" \
- "dl5.out" \
- "-ansi $NOSANITIZE_CFLAGS" \
- "c++" \
- ] \
- [list \
- "Run with libnew1b.so" \
- "-Wl,--no-as-needed tmpdir/libnew1b.so $NOSANITIZE_CFLAGS" \
- "" \
- {dl5.cc} \
- "dl5b" \
- "dl5.out" \
- "-ansi $NOSANITIZE_CFLAGS" \
- "c++" \
- ] \
-]
+ run_ld_link_exec_tests [list \
+ [list \
+ "Run with libnew1a.so" \
+ "-Wl,--no-as-needed tmpdir/libnew1a.so $NOSANITIZE_CFLAGS" \
+ "" \
+ {dl5.cc} \
+ "dl5a" \
+ "dl5.out" \
+ "-ansi $NOSANITIZE_CFLAGS" \
+ "c++" \
+ ] \
+ [list \
+ "Run with libnew1b.so" \
+ "-Wl,--no-as-needed tmpdir/libnew1b.so $NOSANITIZE_CFLAGS" \
+ "" \
+ {dl5.cc} \
+ "dl5b" \
+ "dl5.out" \
+ "-ansi $NOSANITIZE_CFLAGS" \
+ "c++" \
+ ] \
+ ]
-run_cc_link_tests $build_cxx_tests
-run_ld_link_exec_tests $run_cxx_tests
+ run_cc_link_tests $build_cxx_tests
+ run_ld_link_exec_tests $run_cxx_tests
+}
if { [istarget *-*-linux*]
|| [istarget *-*-gnu*] } {
More information about the Binutils-cvs
mailing list