* ld testsuite CFLAGS_FOR_TARGET
@ 2023-03-28 23:20 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-03-28 23:20 UTC (permalink / raw)
To: binutils
run_host_cmd adds $gcc_B_opt and $ld_L_opt to the command line if it
detects the program being run is a compiler. Since the program being
run in lto.exp linking pr28138 is "sh", we need to add these by hand.
This isn't exactly as run_host_cmd does, as it lacks reordering of
any user -B option in $CC_FOR_TARGET, but it's better than ignoring
gcc_B_opt. This fixes a mips64 testsuite fail.
ld_compile adds CFLAGS_FOR_TARGET and other flags as well, so there
is no need for the ld_compile command line to include
CFLAGS_FOR_TARGET. Fixing this is just a tidy.
* testsuite/ld-plugin/lto.exp: Add gcc_B_opt, CFLAGS_FOR_TARGET
and $ld_L_opt to pr28138 link line.
* testsuite/lib/ld-lib.exp (run_ld_link_tests): Don't pass
unnecessary flags to ld_compile.
(run_ld_link_exec_tests, run_cc_link_tests): Likewise.
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 6c1322e43e0..98e811177ef 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -773,7 +773,8 @@ run_cc_link_tests [list \
set exec_output [run_host_cmd "sh" \
"-c \"ulimit -n 20; \
- $CC_FOR_TARGET -Btmpdir/ld -o tmpdir/pr28138 \
+ $CC_FOR_TARGET $gcc_B_opt $CFLAGS_FOR_TARGET \
+ $ld_L_opt -o tmpdir/pr28138 \
tmpdir/pr28138.o tmpdir/pr28138.a\""]
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 47e86a7b27c..918464069a9 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -467,7 +467,6 @@ proc run_ld_link_tests { ldtests args } {
global subdir
global env
global CC_FOR_TARGET
- global CFLAGS_FOR_TARGET
global runtests
global exec_output
@@ -534,7 +533,7 @@ proc run_ld_link_tests { ldtests args } {
set objfile "tmpdir/$fileroot.o"
if { [file extension $src_file] == ".c" } {
set as_file "tmpdir/$fileroot.s"
- if ![ld_compile "$CC_FOR_TARGET -S $CFLAGS_FOR_TARGET $cflags" $srcdir/$subdir/$src_file $as_file] {
+ if ![ld_compile "$CC_FOR_TARGET -S $cflags" $srcdir/$subdir/$src_file $as_file] {
set is_unsupported 1
break
}
@@ -685,8 +684,6 @@ proc run_ld_link_exec_tests { ldtests args } {
global env
global CC_FOR_TARGET
global CXX_FOR_TARGET
- global CFLAGS_FOR_TARGET
- global CXXFLAGS_FOR_TARGET
global errcnt
global exec_output
global board_cflags
@@ -753,9 +750,9 @@ proc run_ld_link_exec_tests { ldtests args } {
lappend objfiles $objfile
if { [ string match "c++" $lang ] } {
- set cmd "$CXX_FOR_TARGET -c $CXXFLAGS_FOR_TARGET $cflags"
+ set cmd "$CXX_FOR_TARGET -c $cflags"
} else {
- set cmd "$CC_FOR_TARGET -c $CFLAGS_FOR_TARGET $cflags"
+ set cmd "$CC_FOR_TARGET -c $cflags"
}
if ![ld_compile $cmd $srcdir/$subdir/$src_file $objfile] {
set failed 1
@@ -860,8 +857,6 @@ proc run_cc_link_tests { ldtests } {
global env
global CC_FOR_TARGET
global CXX_FOR_TARGET
- global CFLAGS_FOR_TARGET
- global CXXFLAGS_FOR_TARGET
global ar
global exec_output
global board_cflags
@@ -950,9 +945,9 @@ proc run_cc_link_tests { ldtests } {
lappend objfiles $objfile
if { [ string match "c++" $lang ] } {
- set cmd "$CXX_FOR_TARGET -c $CXXFLAGS_FOR_TARGET $cflags"
+ set cmd "$CXX_FOR_TARGET -c $cflags"
} else {
- set cmd "$CC_FOR_TARGET -c $CFLAGS_FOR_TARGET $cflags"
+ set cmd "$CC_FOR_TARGET -c $cflags"
}
if ![ld_compile $cmd $srcdir/$subdir/$src_file $objfile] {
set failed 1
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-28 23:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-28 23:20 ld testsuite CFLAGS_FOR_TARGET Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).