aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2021-02-25 05:07:37 +0100
committerHans-Peter Nilsson <hp@axis.com>2021-03-03 00:15:17 +0100
commit7fddf3dbb98a5824140da0bb442738f54031d3bf (patch)
tree91601487d161da150ad3af232868729096bd02d1
parent8b6ebc025cf2b25fdc1e8f6e6261701dc71bac74 (diff)
downloadgcc-7fddf3dbb98a5824140da0bb442738f54031d3bf.zip
gcc-7fddf3dbb98a5824140da0bb442738f54031d3bf.tar.gz
gcc-7fddf3dbb98a5824140da0bb442738f54031d3bf.tar.bz2
outputs.exp: skip @file -save-temps if target has -L or -I
The outputs.exp tests check what temporary files are created and left behind with e.g. -save-temps. Additional files are created in presence of @file option. Adding an -I or -L option causes *another* temporary file to appear. I take it that's deliberate, as there are tests for that behavior. For native testing, the default test-framework baseboard file unix.exp doesn't add any -I or -L options and all tests pass. For a newlib target however, you'll have a couple of -L options (see the nopts handling in outputs.exp), leading to: Running /x/gcc/gcc/testsuite/gcc.misc-tests/outputs.exp ... FAIL: outputs exe savetmp namedb: extra outputs.args.1 FAIL: outputs exe savetmp named2: extra outputs.args.1 FAIL: outputs exe savetmp named2: extra outputs.args.3 FAIL: outputs lto sing unnamed: extra a.args.1 The failing tests are among the actual tests that check the behavior of @file, and are confused by the additional -L. Identify presence of -I or -L from the test framework and skip those tests. Tested cris-elf and x86_64-pc-linux-gnu. gcc/testsuite: * gcc.misc-tests/outputs.exp: Skip @file -save-temps tests if target test-framework has -L or -I options.
-rw-r--r--gcc/testsuite/gcc.misc-tests/outputs.exp12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.misc-tests/outputs.exp b/gcc/testsuite/gcc.misc-tests/outputs.exp
index 4d904bd..ebd6144 100644
--- a/gcc/testsuite/gcc.misc-tests/outputs.exp
+++ b/gcc/testsuite/gcc.misc-tests/outputs.exp
@@ -57,10 +57,18 @@ set gld [check_effective_target_gld]
# We do not compile to an executable, because that requires naming an output.
set link_options ""
set dest [target_info name]
+set skip_atsave 0
foreach i { ldflags libs ldscript } {
if {[board_info $dest exists $i]} {
set opts [board_info $dest $i]
set nopts [gcc_adjust_linker_flags_list $opts]
+
+ # Options -I<X> and -L<X> affect the behavior of @files
+ # wrt. temporary files. Skip @file -save-temps tests if we
+ # have any of them in the board-flags.
+ if { [string match "* -\[LI\]*" " $nopts"]} {
+ set skip_atsave 1
+ }
foreach opt $nopts {
append link_options " additional_flags=$opt"
}
@@ -298,10 +306,12 @@ outest "$b exe savetmp namedb" $sing "-o $b.exe -save-temps" {} {{--0.i --0.s --
outest "$b exe savetmp named2" $mult "-o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .exe}}
# Additional files are created when an @file is used
+if !$skip_atsave {
outest "$b exe savetmp namedb" $sing "@/dev/null -o $b.exe -save-temps" {} {{--0.i --0.s --0.o .args.0 !!$gld .ld1_args !0 .exe}}
outest "$b exe savetmp named2" $mult "@/dev/null -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .args.0 !!$gld .ld1_args !0 .exe}}
outest "$b exe savetmp named2" $mult "@/dev/null -I dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 !!$gld .ld1_args !0 .exe}}
outest "$b exe savetmp named2" $mult "@/dev/null -I dummy -L dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 .args.3 !!$gld .ld1_args !0 .exe}}
+}
# Setting the main output to a dir selects it as the default aux&dump
# location.
@@ -657,8 +667,10 @@ outest "$b lto sing named" $sing "-o $b.exe -O2 -flto -fno-use-linker-plugin -fl
outest "$b lto mult named" $mult "-o $b.exe -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{--1.c.???i.icf --1.c.???r.final --2.c.???i.icf --2.c.???r.final .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe}}
outest "$b lto sing nameddir" $sing "-o dir/$b.exe -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.c.???i.icf --0.c.???r.final .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe} {}}
outest "$b lto mult nameddir" $mult "-o dir/$b.exe -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --1.c.???r.final --2.c.???i.icf --2.c.???r.final .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe} {}}
+if !$skip_atsave {
outest "$b lto sing unnamed" $sing "@/dev/null -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage -save-temps $oaout" {} {{a--0.c.???i.icf a--0.c.???r.final a.wpa.???i.icf a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a--0.o a--0.s a--0.i a.ltrans0.o a.ltrans.out a.ltrans0.ltrans.o a.ltrans0.ltrans_args a.args.0 a.ltrans0.ltrans.s a.wpa.args.0 a.lto_args a.ld1_args a.ltrans_args a.ltrans0.ltrans.args.0 a.ld_args $aout}}
}
+}
# -dumpbase without -dumpdir. The trailing dumppfx dash after it is
# combined with dumpbase turns into a period when passed to lto as