aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2025-08-27 17:36:57 +0930
committerAlan Modra <amodra@gmail.com>2025-08-27 21:45:12 +0930
commit93dfa8e923a06c52a707e19109fef07601f6d114 (patch)
treec5b66be24bfb825fa66e24af52ee10019dd8a187
parentd8867f5d1bf878b6857ee7f9be28a1b8317c40e3 (diff)
downloadbinutils-93dfa8e923a06c52a707e19109fef07601f6d114.zip
binutils-93dfa8e923a06c52a707e19109fef07601f6d114.tar.gz
binutils-93dfa8e923a06c52a707e19109fef07601f6d114.tar.bz2
objcopy "strip without global symbol" test
This binutils test fails with -fsanitize. NOSANITIZE_CFLAGS isn't available in the binutils testsuite, and importing it over from ld requires a huge amount of tcl code to be moved. So I chose to simply add -fno-sanitize=all if -fsanitize= is seem in CFLAGS. * testsuite/binutils-all/objcopy.exp (objcopy_test_without_global_symbol): Add -fno-sanitize=all to flags if -fsanitize= is found in CFLAGS_FOR_TARGET. Tidy use of objfile.
-rw-r--r--binutils/testsuite/binutils-all/objcopy.exp13
1 files changed, 9 insertions, 4 deletions
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index 90be636..c5ff1e3 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -1463,18 +1463,23 @@ proc objcopy_test_without_global_symbol { } {
global OBJDUMPFLAGS
global srcdir
global subdir
+ global CFLAGS_FOR_TARGET
set test "strip without global symbol "
- if { [target_compile $srcdir/$subdir/pr19547.c tmpdir/pr19547.o object debug] != "" } {
+ set opts "debug"
+ if [string match "*-fsanitize=*" $CFLAGS_FOR_TARGET] {
+ append opts " additional_flags=-fno-sanitize=all"
+ }
+
+ set objfile tmpdir/pr19547.o
+ if { [target_compile $srcdir/$subdir/pr19547.c $objfile object $opts] != "" } {
untested $test
return
}
if [is_remote host] {
- set objfile [remote_download host tmpdir/pr19547.o]
- } else {
- set objfile tmpdir/pr19547.o
+ set objfile [remote_download host $objfile]
}
set exec_output [binutils_run $OBJCOPY "$OBJCOPYFLAGS --strip-unneeded $objfile"]