revamp dump and aux output names

This patch simplifies (!!!) the logic governing the naming of dump
files and auxiliary output files in the driver, in the compiler, and
in the LTO wrapper.  No changes are made to the naming of primary
outputs, there are often ways to restore past behavior, and a number
of inconsistencies are fixed.  Some internal options are removed
(-auxbase and -auxbase-strip), sensible existing uses of -dumpdir and
-dumpbase options remain unchanged, additional useful cases are added,
making for what is still admittedly quite complex.  Extensive
documentation and testcases provide numerous examples, from normal to
corner cases.

The most visible changes are:

- aux and dump files now always go in the same directory, that
defaults to the directory of the primary output, but that can be
overridden with -dumpdir, -save-temps=*, or, preserving past behavior,
with a -dumpbase with a directory component.

- driver and compiler now have the same notion of naming of auxiliary
outputs, e.g. .dwo files will no longer be in one location while the
debug info suggests they are elsewhere, and -save-temps and .dwo
auxiliary outputs now go in the same location as .su, .ci and
coverage data, with consistent naming.

- explicitly-specified primary output names guide not only the
location of aux and dump outputs: the output base name is also used in
their base name, as a prefix when also linking (e.g. foo.c bar.c -o
foobar creates foobar-foo.dwo and foobar-bar.dwo with -gsplit-dwarf),
or as the base name instead of the input name (foo.c -c -o whatever.o
creates whatever.su rather than foo.su with -fstack-usage).  The
preference for the input file base name, quite useful for our
testsuite, can be restored with -dumpbase "".  When compiling and
linking tests in the testsuite with additional inputs, we now use this
flag.  Files named in dejagnu board ldflags, libs, and ldscripts are
now quoted in the gcc testsuite with -Wl, so that they are not counted
as additional inputs by the compiler driver.

- naming a -dumpbase when compiling multiple sources used to cause
dumps from later compiles to overwrite those of earlier ones; it is
now used as a prefix when compiling multiple sources, like an
executable name above.

- the dumpbase, explicitly specified or computed from output or input
names, now also governs the naming of aux outputs; since aux outputs
usually replaced the suffix from the input name, while dump outputs
append their own additional suffixes, a -dumpbase-ext option is
introduced to enable a chosen suffix to be dropped from dumpbase to
form aux output names.

- LTO dump and aux outputs were quite a mess, sometimes leaking
temporary output names into -save-temps output names, sometimes
conversely generating desirable aux outputs in temporary locations.
They now obey the same logic of compiler aux and dump outputs, landing
in the expected location and taking the linker output name or an
explicit dumpbase overrider into account.

- Naming of -fdump-final-insns outputs now follows the dump file
naming logic for the .gkd files, and the .gk dump files generated in
the second -fcompare-debug compilation get the .gk inserted before the
suffix that -dumpbase-ext drops in aux outputs.


gcc/ChangeLog:

	* common.opt (aux_base_name): Define.
	(dumpbase, dumpdir): Mark as Driver options.
	(-dumpbase, -dumpdir): Likewise.
	(dumpbase-ext, -dumpbase-ext): New.
	(auxbase, auxbase-strip): Drop.
	* doc/invoke.texi (-dumpbase, -dumpbase-ext, -dumpdir):
	Document.
	(-o): Introduce the notion of primary output, mention it
	influences auxiliary and dump output names as well, add
	examples.
	(-save-temps): Adjust, move examples into -dump*.
	(-save-temps=cwd, -save-temps=obj): Likewise.
	(-fdump-final-insns): Adjust.
	* dwarf2out.c (gen_producer_string): Drop auxbase and
	auxbase_strip; add dumpbase_ext.
	* gcc.c (enum save_temps): Add SAVE_TEMPS_DUMP.
	(save_temps_prefix, save_temps_length): Drop.
	(save_temps_overrides_dumpdir): New.
	(dumpdir, dumpbase, dumpbase_ext): New.
	(dumpdir_length, dumpdir_trailing_dash_added): New.
	(outbase, outbase_length): New.
	(The Specs Language): Introduce %".  Adjust %b and %B.
	(ASM_FINAL_SPEC): Use %b.dwo for an aux output name always.
	Precede object file with %w when it's the primary output.
	(cpp_debug_options): Do not pass on incoming -dumpdir,
	-dumpbase and -dumpbase-ext options; recompute them with
	%:dumps.
	(cc1_options): Drop auxbase with and without compare-debug;
	use cpp_debug_options instead of dumpbase.  Mark asm output
	with %w when it's the primary output.
	(static_spec_functions): Drop %:compare-debug-auxbase-opt and
	%:replace-exception.  Add %:dumps.
	(driver_handle_option): Implement -save-temps=*/-dumpdir
	mutual overriding logic.  Save dumpdir, dumpbase and
	dumpbase-ext options.  Do not save output_file in
	save_temps_prefix.
	(adds_single_suffix_p): New.
	(single_input_file_index): New.
	(process_command): Combine output dir, output base name, and
	dumpbase into dumpdir and outbase.
	(set_collect_gcc_options): Pass a possibly-adjusted -dumpdir.
	(do_spec_1): Optionally dumpdir instead of save_temps_prefix,
	and outbase instead of input_basename in %b, %B and in
	-save-temps aux files.  Handle empty argument %".
	(driver::maybe_run_linker): Adjust dumpdir and auxbase.
	(compare_debug_dump_opt_spec_function): Adjust gkd dump file
	naming.  Spec-quote the computed -fdump-final-insns file name.
	(debug_auxbase_opt): Drop.
	(compare_debug_self_opt_spec_function): Drop auxbase-strip
	computation.
	(compare_debug_auxbase_opt_spec_function): Drop.
	(not_actual_file_p): New.
	(replace_extension_spec_func): Drop.
	(dumps_spec_func): New.
	(convert_white_space): Split-out parts into...
	(quote_string, whitespace_to_convert_p): ... these.  New.
	(quote_spec_char_p, quote_spec, quote_spec_arg): New.
	(driver::finalize): Release and reset new variables; drop
	removed ones.
	* lto-wrapper.c (HAVE_TARGET_EXECUTABLE_SUFFIX): Define if...
	(TARGET_EXECUTABLE_SUFFIX): ... is defined; define this to the
	empty string otherwise.
	(DUMPBASE_SUFFIX): Drop leading period.
	(debug_objcopy): Use concat.
	(run_gcc): Recognize -save-temps=* as -save-temps too.  Obey
	-dumpdir.  Pass on empty dumpdir and dumpbase with a directory
	component.  Simplify temp file names.
	* opts.c (finish_options): Drop aux base name handling.
	(common_handle_option): Drop auxbase-strip handling.
	* toplev.c (print_switch_values): Drop auxbase, add
	dumpbase-ext.
	(process_options): Derive aux_base_name from dump_base_name
	and dump_base_ext.
	(lang_dependent_init): Compute dump_base_ext along with
	dump_base_name.  Disable stack usage and callgraph-info	during
	lto generation and compare-debug recompilation.

gcc/fortran/ChangeLog:

	* options.c (gfc_get_option_string): Drop auxbase, add
	dumpbase_ext.

gcc/ada/ChangeLog:

	* gcc-interface/lang-specs.h: Drop auxbase and auxbase-strip.
	Use %:dumps instead of -dumpbase.  Add %w for implicit .s
	primary output.
	* switch.adb (Is_Internal_GCC_Switch): Recognize dumpdir and
	dumpbase-ext.  Drop auxbase and auxbase-strip.

lto-plugin/ChangeLog:

	* lto-plugin.c (skip_in_suffix): New.
	(exec_lto_wrapper): Use skip_in_suffix and concat to build
	non-temporary output names.
	(onload): Look for -dumpdir in COLLECT_GCC_OPTIONS, and
	override link_output_name with it.

contrib/ChangeLog:

	* compare-debug: Adjust for .gkd files named as dump files,
	with the source suffix rather than the object suffix.

gcc/testsuite/ChangeLog:

	* gcc.misc-tests/outputs.exp: New.
	* gcc.misc-tests/outputs-0.c: New.
	* gcc.misc-tests/outputs-1.c: New.
	* gcc.misc-tests/outputs-2.c: New.
	* lib/gcc-defs.exp (gcc_adjusted_linker_flags): New.
	(gcc_adjust_linker_flags): New.
	(dg-additional-files-options): Call it.  Pass -dumpbase ""
	when there are additional sources.
	* lib/profopt.exp (profopt-execute): Pass the executable
	suffix with -dumpbase-ext.
	* lib/scandump.exp (dump-base): Mention -dumpbase "" use.
	* lib/scanltranstree.exp: Adjust dump suffix expectation.
	* lib/scanwpaipa.exp: Likewise.
This commit is contained in:
Alexandre Oliva 2020-05-26 04:30:15 -03:00 committed by Alexandre Oliva
parent 4945b4c2c8
commit 1dedc12d18
21 changed files with 2130 additions and 423 deletions

View File

@ -2,7 +2,7 @@
# Compare stripped copies of two given object files.
# Copyright (C) 2007, 2008, 2009, 2010, 2012 Free Software Foundation
# Copyright (C) 2007, 2008, 2009, 2010, 2012, 2020 Free Software Foundation
# Originally by Alexandre Oliva <aoliva@redhat.com>
# This file is part of GCC.
@ -183,8 +183,28 @@ $rm "$1.$suf1" "$2.$suf2"
trap "exit $status; exit" 0 1 2 15
if test -f "$1".gkd || test -f "$2".gkd; then
if cmp "$1".gkd "$2".gkd; then
# Replace the suffix in $1 and $2 with .*.gkd, compare them if a
# single file is found by the globbing.
base1=`echo "$1" | sed '$s,\.[^.]*$,,'` gkd1=
for f in "$base1".*.gkd; do
if test "x$gkd1" != x; then
gkd1=
break
elif test -f "$f"; then
gkd1=$f
fi
done
base2=`echo "$2" | sed '$s,\.[^.]*$,,'` gkd2=
for f in "$base2".*.gkd; do
if test "x$gkd2" != x; then
gkd2=
break
elif test -f "$f"; then
gkd2=$f
fi
done
if test "x$gkd1" != x || test "x$gkd2" != x; then
if cmp "${gkd1-/dev/null}" "${gkd2-/dev/null}"; then
:
else
status=$?

View File

@ -34,17 +34,15 @@
%{!S:%{!c:%e-c or -S required for Ada}}\
gnat1 %{I*} %{k8:-gnatk8} %{Wall:-gnatwa} %{w:-gnatws} %{!Q:-quiet}\
%{nostdinc*} %{nostdlib*}\
-dumpbase %{.adb:%b.adb}%{.ads:%b.ads}%{!.adb:%{!.ads:%b.ada}}\
%{fcompare-debug-second:%:compare-debug-auxbase-opt(%b) -gnatd_A} \
%{!fcompare-debug-second:%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}}} \
%{O*} %{W*} %{w} %{p} %{pg:-p} %{d*} \
%{fcompare-debug-second:-gnatd_A} \
%{O*} %{W*} %{w} %{p} %{pg:-p} %{d*} %:dumps(%{!.adb:%{!.ads:.ada}}) \
%{coverage:-fprofile-arcs -ftest-coverage} "
#if defined(TARGET_VXWORKS_RTP)
"%{fRTS=rtp|fRTS=rtp-smp|fRTS=ravenscar-cert-rtp:-mrtp} "
#endif
"%{gnatea:-gnatez} %{g*&m*&f*} "
"%1 %{!S:%{o*:%w%*-gnatO}} \
%i %{S:%W{o*}%{!o*:-o %b.s}} \
%i %{S:%W{o*}%{!o*:-o %w%b.s}} \
%{gnatc*|gnats*: -o %j} %{-param*} \
%{!gnatc*:%{!gnats*:%(invoke_as)}}", 0, 0, 0},
@ -53,9 +51,7 @@
%{!c:%e-c required for gnat2why}\
gnat1why %{I*} %{k8:-gnatk8} %{!Q:-quiet}\
%{nostdinc*} %{nostdlib*}\
-dumpbase %{.adb:%b.adb}%{.ads:%b.ads}%{!.adb:%{!.ads:%b.ada}}\
%{o*:-auxbase-strip %*}%{!o*:-auxbase %b} \
%{a} %{d*} \
%{a} %{d*} %:dumps(%{!.adb:%{!.ads:.ada}}) \
%{gnatea:-gnatez} %{g*&m*&f*} \
%1 %{o*:%w%*-gnatO} \
%i \
@ -66,9 +62,7 @@
%{!c:%e-c required for gnat2scil}\
gnat1scil %{I*} %{k8:-gnatk8} %{!Q:-quiet}\
%{nostdinc*} %{nostdlib*}\
-dumpbase %{.adb:%b.adb}%{.ads:%b.ads}%{!.adb:%{!.ads:%b.ada}}\
%{o*:-auxbase-strip %*}%{!o*:-auxbase %b} \
%{a} %{d*} \
%{a} %{d*} %:dumps(%{!.adb:%{!.ads:.ada}}) \
%{gnatea:-gnatez} %{g*&m*&f*} \
%1 %{o*:%w%*-gnatO} \
%i \

View File

@ -163,9 +163,9 @@ package body Switch is
return Is_Switch (Switch_Chars)
and then
(Switch_Chars (First .. Last) = "-param" or else
Switch_Chars (First .. Last) = "dumpdir" or else
Switch_Chars (First .. Last) = "dumpbase" or else
Switch_Chars (First .. Last) = "auxbase-strip" or else
Switch_Chars (First .. Last) = "auxbase");
Switch_Chars (First .. Last) = "dumpbase-ext");
end Is_Internal_GCC_Switch;
---------------

View File

@ -188,6 +188,12 @@ const char *main_input_basename
Variable
int main_input_baselength
; The base name used for auxiliary output files.
; dump_base_name minus dump_base_ext.
Variable
const char *aux_base_name
; Which options have been printed by --help.
Variable
char *help_printed
@ -252,10 +258,13 @@ Common Separate Alias(d)
Common Joined Alias(d)
-dumpbase
Common Separate Alias(dumpbase)
Driver Common Separate Alias(dumpbase)
-dumpbase-ext
Driver Common Separate Alias(dumpbase-ext)
-dumpdir
Common Separate Alias(dumpdir)
Driver Common Separate Alias(dumpdir)
-entry
Driver Separate Alias(e)
@ -852,12 +861,6 @@ Common Separate Var(aux_info_file_name)
aux-info=
Common Joined Alias(aux-info)
auxbase
Common Separate RejectDriver Var(aux_base_name)
auxbase-strip
Common Separate RejectDriver
coverage
Driver
@ -869,11 +872,15 @@ Common Joined
-d<letters> Enable dumps from specific passes of the compiler.
dumpbase
Common Separate Var(dump_base_name)
Driver Common Separate Var(dump_base_name)
-dumpbase <file> Set the file basename to be used for dumps.
dumpbase-ext
Driver Common Separate Var(dump_base_ext)
-dumpbase-ext .<ext> Drop a trailing .<ext> from the dump basename to name auxiliary output files.
dumpdir
Common Separate Var(dump_dir_name)
Driver Common Separate Var(dump_dir_name)
-dumpdir <dir> Set the directory name to be used for dumps.
dumpmachine

View File

@ -185,7 +185,9 @@ in the following sections.
@table @emph
@item Overall Options
@xref{Overall Options,,Options Controlling the Kind of Output}.
@gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
@gccoptlist{-c -S -E -o @var{file} @gol
-dumpbase @var{dumpbase} -dumpbase-ext @var{auxdropsuf} @gol
-dumpdir @var{dumppfx} -x @var{language} @gol
-v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
-pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
@@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
@ -1602,9 +1604,9 @@ Input files that don't require preprocessing are ignored.
@cindex output file option
@item -o @var{file}
@opindex o
Place output in file @var{file}. This applies to whatever
sort of output is being produced, whether it be an executable file,
an object file, an assembler file or preprocessed C code.
Place the primary output in file @var{file}. This applies to whatever
sort of output is being produced, whether it be an executable file, an
object file, an assembler file or preprocessed C code.
If @option{-o} is not specified, the default is to put an executable
file in @file{a.out}, the object file for
@ -1613,6 +1615,314 @@ assembler file in @file{@var{source}.s}, a precompiled header file in
@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
standard output.
Though @option{-o} names only the primary output, it also affects the
naming of auxiliary and dump outputs. See the examples below. Unless
overridden, both auxiliary outputs and dump outputs are placed in the
same directory as the primary output. In auxiliary outputs, the suffix
of the input file is replaced with that of the auxiliary output file
type; in dump outputs, the suffix of the dump file is appended to the
input file suffix. In compilation commands, the base name of both
auxiliary and dump outputs is that of the primary output; in compile and
link commands, the primary output name, minus the executable suffix, is
combined with the input file name. If both share the same base name,
disregarding the suffix, the result of the combination is that base
name, otherwise, they are concatenated, separated by a dash.
@smallexample
gcc -c foo.c ...
@end smallexample
will use @file{foo.o} as the primary output, and place aux outputs and
dumps next to it, e.g., aux file @file{foo.dwo} for
@option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
@option{-fdump-rtl-final}.
If a non-linker output file is explicitly specified, aux and dump files
by default take the same base name:
@smallexample
gcc -c foo.c -o dir/foobar.o ...
@end smallexample
will name aux outputs @file{dir/foobar.*} and dump outputs
@file{dir/foobar.c.*}.
A linker output will instead prefix aux and dump outputs:
@smallexample
gcc foo.c bar.c -o dir/foobar ...
@end smallexample
will generally name aux outputs @file{dir/foobar-foo.*} and
@file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
@file{dir/foobar-bar.c.*}.
The one exception to the above is when the executable shares the base
name with the single input:
@smallexample
gcc foo.c -o dir/foo ...
@end smallexample
in which case aux outputs are named @file{dir/foo.*} and dump outputs
named @file{dir/foo.c.*}.
The location and the names of auxiliary and dump outputs can be adjusted
by the options @option{-dumpbase}, @option{-dumpbase-ext},
@option{-dumpdir}, @option{-save-temps=cwd}, and
@option{-save-temps=obj}.
@item -dumpbase @var{dumpbase}
@opindex dumpbase
This option sets the base name for auxiliary and dump output files. It
does not affect the name of the primary output file. Intermediate
outputs, when preserved, are not regarded as primary outputs, but as
auxiliary outputs:
@smallexample
gcc -save-temps -S foo.c
@end smallexample
saves the (no longer) temporary preprocessed file in @file{foo.i}, and
then compiles to the (implied) output file @file{foo.s}, whereas:
@smallexample
gcc -save-temps -dumpbase save-foo -c foo.c
@end smallexample
preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
an intermediate, thus auxiliary output), and then assembles to the
(implied) output file @file{foo.o}.
Absent this option, dump and aux files take their names from the input
file, or from the (non-linker) output file, if one is explicitly
specified: dump output files (e.g. those requested by @option{-fdump-*}
options) with the input name suffix, and aux output files (those
requested by other non-dump options, e.g. @code{-save-temps},
@code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
Similar suffix differentiation of dump and aux outputs can be attained
for explicitly-given @option{-dumpbase basename.suf} by also specifying
@option{-dumpbase-ext .suf}.
If @var{dumpbase} is explicitly specified with any directory component,
any @var{dumppfx} specification (e.g. @option{-dumpdir} or
@option{-save-temps=*}) is ignored, and instead of appending to it,
@var{dumpbase} fully overrides it:
@smallexample
gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
-dumpdir pfx- -save-temps=cwd ...
@end smallexample
creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
@file{dir/} in @option{-o}, the @file{./} prefix implied by
@option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
When @option{-dumpbase} is specified in a command that compiles multiple
inputs, or that compiles and then links, it may be combined with
@var{dumppfx}, as specified under @option{-dumpdir}. Then, each input
file is compiled using the combined @var{dumppfx}, and default values
for @var{dumpbase} and @var{auxdropsuf} are computed for each input
file:
@smallexample
gcc foo.c bar.c -c -dumpbase main ...
@end smallexample
creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
overwriting the auxiliary and dump outputs by using the @var{dumpbase}
as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
and @file{main-bar.*}.
An empty string specified as @var{dumpbase} avoids the influence of the
output basename in the naming of auxiliary and dump outputs during
compilation, computing default values :
@smallexample
gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
@end smallexample
will name aux outputs @file{dir/foo.*} and dump outputs
@file{dir/foo.c.*}. Note how their basenames are taken from the input
name, but the directory still defaults to that of the output.
The empty-string dumpbase does not prevent the use of the output
basename for outputs during linking:
@smallexample
gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
@end smallexample
The compilation of the source files will name auxiliary outputs
@file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
@file{dir/foo.c.*} and @file{dir/bar.c.*}. LTO recompilation during
linking will use @file{dir/foobar.} as the prefix for dumps and
auxiliary files.
@item -dumpbase-ext @var{auxdropsuf}
@opindex dumpbase-ext
When forming the name of an auxiliary (but not a dump) output file, drop
trailing @var{auxdropsuf} from @var{dumpbase} before appending any
suffixes. If not specified, this option defaults to the suffix of a
default @var{dumpbase}, i.e., the suffix of the input file when
@option{-dumpbase} is not present in the command line, or @var{dumpbase}
is combined with @var{dumppfx}.
@smallexample
gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
@end smallexample
creates @file{dir/foo.o} as the main output, and generates auxiliary
outputs in @file{dir/x-foo.*}, taking the location of the primary
output, and dropping the @file{.c} suffix from the @var{dumpbase}. Dump
outputs retain the suffix: @file{dir/x-foo.c.*}.
This option is disregarded if it does not match the suffix of a
specified @var{dumpbase}, except as an alternative to the executable
suffix when appending the linker output base name to @var{dumppfx}, as
specified below:
@smallexample
gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
@end smallexample
creates @file{main.out} as the primary output, and avoids overwriting
the auxiliary and dump outputs by using the executable name minus
@var{auxdropsuf} as a prefix, creating auxiliary outputs named
@file{main-foo.*} and @file{main-bar.*} and dump outputs named
@file{main-foo.c.*} and @file{main-bar.c.*}.
@item -dumpdir @var{dumppfx}
@opindex dumpdir
When forming the name of an auxiliary or dump output file, use
@var{dumppfx} as a prefix:
@smallexample
gcc -dumpdir pfx- -c foo.c ...
@end smallexample
creates @file{foo.o} as the primary output, and auxiliary outputs named
@file{pfx-foo.*}, combining the given @var{dumppfx} with the default
@var{dumpbase} derived from the default primary output, derived in turn
from the input name. Dump outputs also take the input name suffix:
@file{pfx-foo.c.*}.
If @var{dumppfx} is to be used as a directory name, it must end with a
directory separator:
@smallexample
gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
@end smallexample
creates @file{obj/bar.o} as the primary output, and auxiliary outputs
named @file{dir/bar.*}, combining the given @var{dumppfx} with the
default @var{dumpbase} derived from the primary output name. Dump
outputs also take the input name suffix: @file{dir/bar.c.*}.
It defaults to the location of the output file; options
@option{-save-temps=cwd} and @option{-save-temps=obj} override this
default, just like an explicit @option{-dumpdir} option. In case
multiple such options are given, the last one prevails:
@smallexample
gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
@end smallexample
outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
@option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
@option{-dumpdir} option. It does not matter that @option{=obj} is the
default for @option{-save-temps}, nor that the output directory is
implicitly the current directory. Dump outputs are named
@file{foo.c.*}.
When compiling from multiple input files, if @option{-dumpbase} is
specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
are appended to (or override, if containing any directory components) an
explicit or defaulted @var{dumppfx}, so that each of the multiple
compilations gets differently-named aux and dump outputs.
@smallexample
gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
@end smallexample
outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
@file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
and @file{dir/pfx-main-bar.c.*}, respectively. Contrast with the
single-input compilation:
@smallexample
gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
@end smallexample
that, applying @option{-dumpbase} to a single source, does not compute
and append a separate @var{dumpbase} per input file. Its auxiliary and
dump outputs go in @file{dir/pfx-main.*}.
When compiling and then linking from multiple input files, a defaulted
or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
transformation above (e.g. the compilation of @file{foo.c} and
@file{bar.c} above, but without @option{-c}). If neither
@option{-dumpdir} nor @option{-dumpbase} are given, the linker output
base name, minus @var{auxdropsuf}, if specified, or the executable
suffix otherwise, plus a dash is appended to the default @var{dumppfx}
instead. Note, however, that unlike earlier cases of linking:
@smallexample
gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
@end smallexample
does not append the output name @file{main} to @var{dumppfx}, because
@option{-dumpdir} is explicitly specified. The goal is that the
explicitly-specified @var{dumppfx} may contain the specified output name
as part of the prefix, if desired; only an explicitly-specified
@option{-dumpbase} would be combined with it, in order to avoid simply
discarding a meaningful option.
When compiling and then linking from a single input file, the linker
output base name will only be appended to the default @var{dumppfx} as
above if it does not share the base name with the single input file
name. This has been covered in single-input linking cases above, but
not with an explicit @option{-dumpdir} that inhibits the combination,
even if overridden by @option{-save-temps=*}:
@smallexample
gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
@end smallexample
Auxiliary outputs are named @file{foo.*}, and dump outputs
@file{foo.c.*}, in the current working directory as ultimately requested
by @option{-save-temps=cwd}.
Summing it all up for an intuitive though slightly imprecise data flow:
the primary output name is broken into a directory part and a basename
part; @var{dumppfx} is set to the former, unless overridden by
@option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
to the latter, unless overriden by @option{-dumpbase}. If there are
multiple inputs or linking, this @var{dumpbase} may be combined with
@var{dumppfx} and taken from each input file. Auxiliary output names
for each input are formed by combining @var{dumppfx}, @var{dumpbase}
minus suffix, and the auxiliary output suffix; dump output names are
only different in that the suffix from @var{dumpbase} is retained.
When it comes to auxiliary and dump outputs created during LTO
recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
given or as derived from the linker output name but not from inputs,
even in cases in which this combination would not otherwise be used as
such, is passed down with a trailing period replacing the compiler-added
dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
being involved in linking, this program does not normally get any
@option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
When running sub-compilers, @command{lto-wrapper} appends LTO stage
names to the received @var{dumppfx}, ensures it contains a directory
component so that it overrides any @option{-dumpdir}, and passes that as
@option{-dumpbase} to sub-compilers.
@item -v
@opindex v
Print (on standard error output) the commands executed to run the stages
@ -16279,14 +16589,10 @@ computing CRC32).
The @var{string} should be different for every file you compile.
@item -save-temps
@itemx -save-temps=cwd
@opindex save-temps
Store the usual ``temporary'' intermediate files permanently; place them
in the current directory and name them based on the source file. Thus,
compiling @file{foo.c} with @option{-c -save-temps} produces files
@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
preprocessed @file{foo.i} output file even though the compiler now
normally uses an integrated preprocessor.
Store the usual ``temporary'' intermediate files permanently; name them
as auxiliary output files, as specified described under
@option{-dumpbase} and @option{-dumpdir}.
When used in combination with the @option{-x} command-line option,
@option{-save-temps} is sensible enough to avoid overwriting an
@ -16294,39 +16600,17 @@ input source file with the same extension as an intermediate file.
The corresponding intermediate file may be obtained by renaming the
source file before using @option{-save-temps}.
If you invoke GCC in parallel, compiling several different source
files that share a common base name in different subdirectories or the
same source file compiled for multiple output destinations, it is
likely that the different parallel compilers will interfere with each
other, and overwrite the temporary files. For instance:
@smallexample
gcc -save-temps -o outdir1/foo.o indir1/foo.c&
gcc -save-temps -o outdir2/foo.o indir2/foo.c&
@end smallexample
may result in @file{foo.i} and @file{foo.o} being written to
simultaneously by both compilers.
@item -save-temps=cwd
@opindex save-temps=cwd
Equivalent to @option{-save-temps -dumpdir ./}.
@item -save-temps=obj
@opindex save-temps=obj
Store the usual ``temporary'' intermediate files permanently. If the
@option{-o} option is used, the temporary files are based on the
object file. If the @option{-o} option is not used, the
@option{-save-temps=obj} switch behaves like @option{-save-temps}.
For example:
@smallexample
gcc -save-temps=obj -c foo.c
gcc -save-temps=obj -c bar.c -o dir/xbar.o
gcc -save-temps=obj foobar.c -o dir2/yfoobar
@end smallexample
@noindent
creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
@file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
@file{dir2/yfoobar.o}.
Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
@file{outdir/} is the directory of the output file specified after the
@option{-o} option, including any directory separators. If the
@option{-o} option is not used, the @option{-save-temps=obj} switch
behaves like @option{-save-temps=cwd}.
@item -time@r{[}=@var{file}@r{]}
@opindex time
@ -16363,7 +16647,7 @@ can later tell what file was being compiled, and with which options.
Dump the final internal representation (RTL) to @var{file}. If the
optional argument is omitted (or if @var{file} is @code{.}), the name
of the dump file is determined by appending @code{.gkd} to the
compilation output file name.
dump base name, see @option{-dumpbase}.
@item -fcompare-debug@r{[}=@var{opts}@r{]}
@opindex fcompare-debug
@ -30630,17 +30914,24 @@ together or combine them with constant text in a single argument.
@item %%
Substitute one @samp{%} into the program name or argument.
@item %"
Substitute an empty argument.
@item %i
Substitute the name of the input file being processed.
@item %b
Substitute the basename of the input file being processed.
This is the substring up to (and not including) the last period
and not including the directory.
Substitute the basename for outputs related with the input file being
processed. This is often the substring up to (and not including) the
last period and not including the directory but, unless %w is active, it
expands to the basename for auxiliary outputs, which may be influenced
by an explicit output name, and by various other options that control
how auxiliary outputs are named.
@item %B
This is the same as @samp{%b}, but include the file suffix (text after
the last period).
the last period). Without %w, it expands to the basename for dump
outputs.
@item %d
Marks the argument containing or following the @samp{%d} as a

View File

@ -24351,9 +24351,8 @@ gen_producer_string (void)
case OPT_o:
case OPT_d:
case OPT_dumpbase:
case OPT_dumpbase_ext:
case OPT_dumpdir:
case OPT_auxbase:
case OPT_auxbase_strip:
case OPT_quiet:
case OPT_version:
case OPT_v:

View File

@ -838,8 +838,8 @@ gfc_get_option_string (void)
case OPT_o:
case OPT_d:
case OPT_dumpbase:
case OPT_dumpbase_ext:
case OPT_dumpdir:
case OPT_auxbase:
case OPT_quiet:
case OPT_version:
case OPT_fintrinsic_modules_path:
@ -864,8 +864,8 @@ gfc_get_option_string (void)
case OPT_o:
case OPT_d:
case OPT_dumpbase:
case OPT_dumpbase_ext:
case OPT_dumpdir:
case OPT_auxbase:
case OPT_quiet:
case OPT_version:
case OPT_fintrinsic_modules_path:

950
gcc/gcc.c

File diff suppressed because it is too large Load Diff

View File

@ -53,6 +53,13 @@ along with GCC; see the file COPYING3. If not see
driver to lto-wrapper. */
#define OFFLOAD_TARGET_NAMES_ENV "OFFLOAD_TARGET_NAMES"
/* By default there is no special suffix for target executables. */
#ifdef TARGET_EXECUTABLE_SUFFIX
#define HAVE_TARGET_EXECUTABLE_SUFFIX
#else
#define TARGET_EXECUTABLE_SUFFIX ""
#endif
enum lto_mode_d {
LTO_MODE_NONE, /* Not doing LTO. */
LTO_MODE_LTO, /* Normal LTO. */
@ -126,7 +133,7 @@ maybe_unlink (const char *file)
}
/* Template of LTRANS dumpbase suffix. */
#define DUMPBASE_SUFFIX ".ltrans18446744073709551615"
#define DUMPBASE_SUFFIX "ltrans18446744073709551615"
/* Create decoded options from the COLLECT_GCC and COLLECT_GCC_OPTIONS
environment. */
@ -1100,12 +1107,7 @@ debug_objcopy (const char *infile, bool rename)
}
if (save_temps)
{
outfile = (char *) xmalloc (strlen (orig_infile)
+ sizeof (".debug.temp.o") + 1);
strcpy (outfile, orig_infile);
strcat (outfile, ".debug.temp.o");
}
outfile = concat (orig_infile, ".debug.temp.o", NULL);
else
outfile = make_temp_file (".debug.temp.o");
errmsg = simple_object_copy_lto_debug_sections (inobj, outfile, &err, rename);
@ -1296,6 +1298,8 @@ run_gcc (unsigned argc, char *argv[])
bool linker_output_rel = false;
bool skip_debug = false;
unsigned n_debugobj;
const char *dumppfx = NULL, *incoming_dumppfx = NULL;
static char current_dir[] = { '.', DIR_SEPARATOR, '\0' };
/* Get the driver and options. */
collect_gcc = getenv ("COLLECT_GCC");
@ -1407,6 +1411,10 @@ run_gcc (unsigned argc, char *argv[])
linker_output = option->arg;
break;
/* We don't have to distinguish between -save-temps=* and
-save-temps, -dumpdir already carries that
information. */
case OPT_save_temps_:
case OPT_save_temps:
save_temps = 1;
break;
@ -1452,6 +1460,10 @@ run_gcc (unsigned argc, char *argv[])
skip_debug = option->arg && !strcmp (option->arg, "0");
break;
case OPT_dumpdir:
incoming_dumppfx = dumppfx = option->arg;
break;
default:
break;
}
@ -1490,32 +1502,47 @@ run_gcc (unsigned argc, char *argv[])
}
}
if (linker_output)
if (!dumppfx)
{
char *output_dir, *base, *name;
bool bit_bucket = strcmp (linker_output, HOST_BIT_BUCKET) == 0;
output_dir = xstrdup (linker_output);
base = output_dir;
for (name = base; *name; name++)
if (IS_DIR_SEPARATOR (*name))
base = name + 1;
*base = '\0';
linker_output = &linker_output[base - output_dir];
if (*output_dir == '\0')
if (!linker_output
|| strcmp (linker_output, HOST_BIT_BUCKET) == 0)
dumppfx = "a.";
else
{
static char current_dir[] = { '.', DIR_SEPARATOR, '\0' };
output_dir = current_dir;
const char *obase = lbasename (linker_output), *temp;
/* Strip the executable extension. */
size_t blen = strlen (obase), xlen;
if ((temp = strrchr (obase + 1, '.'))
&& (xlen = strlen (temp))
&& (strcmp (temp, ".exe") == 0
#if defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
|| strcmp (temp, TARGET_EXECUTABLE_SUFFIX) == 0
#endif
|| strcmp (obase, "a.out") == 0))
dumppfx = xstrndup (linker_output,
obase - linker_output + blen - xlen + 1);
else
dumppfx = concat (linker_output, ".", NULL);
}
if (!bit_bucket)
}
/* If there's no directory component in the dumppfx, add one, so
that, when it is used as -dumpbase, it overrides any occurrence
of -dumpdir that might have been passed in. */
if (!dumppfx || lbasename (dumppfx) == dumppfx)
dumppfx = concat (current_dir, dumppfx, NULL);
/* Make sure some -dumpdir is passed, so as to get predictable
-dumpbase overriding semantics. If we got an incoming -dumpdir
argument, we'll pass it on, so don't bother with another one
then. */
if (!incoming_dumppfx)
{
obstack_ptr_grow (&argv_obstack, "-dumpdir");
obstack_ptr_grow (&argv_obstack, output_dir);
obstack_ptr_grow (&argv_obstack, "");
}
obstack_ptr_grow (&argv_obstack, "-dumpbase");
}
/* Remember at which point we can scrub args to re-use the commons. */
new_head_argc = obstack_object_size (&argv_obstack) / sizeof (void *);
@ -1621,15 +1648,11 @@ cont1:
if (lto_mode == LTO_MODE_LTO)
{
if (linker_output)
{
obstack_ptr_grow (&argv_obstack, linker_output);
flto_out = (char *) xmalloc (strlen (linker_output)
+ sizeof (".lto.o") + 1);
strcpy (flto_out, linker_output);
strcat (flto_out, ".lto.o");
}
else
/* -dumpbase argument for LTO. */
flto_out = concat (dumppfx, "lto.o", NULL);
obstack_ptr_grow (&argv_obstack, flto_out);
if (!save_temps)
flto_out = make_temp_file (".lto.o");
obstack_ptr_grow (&argv_obstack, "-o");
obstack_ptr_grow (&argv_obstack, flto_out);
@ -1637,47 +1660,17 @@ cont1:
else
{
const char *list_option = "-fltrans-output-list=";
size_t list_option_len = strlen (list_option);
char *tmp;
if (linker_output)
{
char *dumpbase = (char *) xmalloc (strlen (linker_output)
+ sizeof (".wpa") + 1);
strcpy (dumpbase, linker_output);
strcat (dumpbase, ".wpa");
/* -dumpbase argument for WPA. */
char *dumpbase = concat (dumppfx, "wpa", NULL);
obstack_ptr_grow (&argv_obstack, dumpbase);
}
if (linker_output && save_temps)
{
ltrans_output_file = (char *) xmalloc (strlen (linker_output)
+ sizeof (".ltrans.out") + 1);
strcpy (ltrans_output_file, linker_output);
strcat (ltrans_output_file, ".ltrans.out");
}
if (save_temps)
ltrans_output_file = concat (dumppfx, "ltrans.out", NULL);
else
{
char *prefix = NULL;
if (linker_output)
{
prefix = (char *) xmalloc (strlen (linker_output) + 2);
strcpy (prefix, linker_output);
strcat (prefix, ".");
}
ltrans_output_file = make_temp_file_with_prefix (prefix,
".ltrans.out");
free (prefix);
}
list_option_full = (char *) xmalloc (sizeof (char) *
(strlen (ltrans_output_file) + list_option_len + 1));
tmp = list_option_full;
obstack_ptr_grow (&argv_obstack, tmp);
strcpy (tmp, list_option);
tmp += list_option_len;
strcpy (tmp, ltrans_output_file);
ltrans_output_file = make_temp_file (".ltrans.out");
list_option_full = concat (list_option, ltrans_output_file, NULL);
obstack_ptr_grow (&argv_obstack, list_option_full);
if (jobserver)
{
@ -1833,16 +1826,10 @@ cont:
output_name = XOBFINISH (&env_obstack, char *);
/* Adjust the dumpbase if the linker output file was seen. */
if (linker_output)
{
char *dumpbase
= (char *) xmalloc (strlen (linker_output)
+ sizeof (DUMPBASE_SUFFIX) + 1);
snprintf (dumpbase,
strlen (linker_output) + sizeof (DUMPBASE_SUFFIX),
"%s.ltrans%u", linker_output, i);
int dumpbase_len = (strlen (dumppfx) + sizeof (DUMPBASE_SUFFIX));
char *dumpbase = (char *) xmalloc (dumpbase_len + 1);
snprintf (dumpbase, dumpbase_len, "%sltrans%u.ltrans", dumppfx, i);
argv_ptr[0] = dumpbase;
}
argv_ptr[1] = "-fltrans";
argv_ptr[2] = "-o";

View File

@ -845,30 +845,6 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
/* We have a DUMP_DIR_NAME, prepend that. */
opts->x_dump_base_name = opts_concat (opts->x_dump_dir_name,
opts->x_dump_base_name, NULL);
else if (opts->x_aux_base_name
&& strcmp (opts->x_aux_base_name, HOST_BIT_BUCKET) != 0)
/* AUX_BASE_NAME is set and is not the bit bucket. If it
contains a directory component, prepend those directories.
Typically this places things in the same directory as the
object file. */
{
const char *aux_base;
base_of_path (opts->x_aux_base_name, &aux_base);
if (opts->x_aux_base_name != aux_base)
{
int dir_len = aux_base - opts->x_aux_base_name;
char *new_dump_base_name
= XOBNEWVEC (&opts_obstack, char,
strlen (opts->x_dump_base_name) + dir_len + 1);
/* Copy directory component from OPTS->X_AUX_BASE_NAME. */
memcpy (new_dump_base_name, opts->x_aux_base_name, dir_len);
/* Append existing OPTS->X_DUMP_BASE_NAME. */
strcpy (new_dump_base_name + dir_len, opts->x_dump_base_name);
opts->x_dump_base_name = new_dump_base_name;
}
}
/* It is definitely prefixed now. */
opts->x_dump_base_name_prefixed = true;
@ -2346,17 +2322,6 @@ common_handle_option (struct gcc_options *opts,
opts->x_flag_gen_aux_info = 1;
break;
case OPT_auxbase_strip:
{
char *tmp = xstrdup (arg);
strip_off_ending (tmp, strlen (tmp));
if (tmp[0])
opts->x_aux_base_name = tmp;
else
free (tmp);
}
break;
case OPT_d:
decode_d_option (arg, opts, loc, dc);
break;

View File

@ -0,0 +1 @@
int main () {}

View File

@ -0,0 +1,4 @@
extern void f();
int main() {
f();
}

View File

@ -0,0 +1,2 @@
void f() {
}

View File

@ -0,0 +1,695 @@
# Copyright (C) 2005-2020 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# This file contains a set of test that check that options intended to
# control the location and name of GCC outputs behave as expected.
load_lib gcc-defs.exp
set b "outputs"
# These tests don't run runtest_file_p consistently if it
# doesn't return the same values, so disable parallelization
# of this *.exp file. The first parallel runtest to reach
# this will run all the tests serially.
if {![gcc_parallel_test_run_p $b] || [is_remote host]} {
return
}
gcc_parallel_test_enable 0
set gsplit_dwarf "-gsplit-dwarf"
if ![check_no_compiler_messages gsplitdwarf object {
void foo (void) { }
} "$gsplit_dwarf"] {
set gsplit_dwarf ""
}
# Prepare additional options to be used for linking.
# We do not compile to an executable, because that requires naming an output.
set link_options ""
set dest [target_info name]
foreach i { ldflags libs ldscripts } {
if {[board_info $dest exists $i]} {
set skip ""
foreach opt [split [board_info $dest $i]] {
if { $skip != "" } then {
set skip ""
} elseif { $opt == "-Xlinker" } then {
set skip $opt
} elseif { ![string match "-*" $opt] && [file isfile $opt] } {
set opt "-Wl,$opt"
}
append link_options " additional_flags=$opt"
}
}
}
if {[board_info $dest exists output_format]} {
append link_options " additional_flags=-Wl,-oformat,[board_info $dest output_format]"
}
# For the test named TEST, run the compiler with SOURCES and OPTS, and
# look in DIRS for OUTPUTS. SOURCES is a list of suffixes for source
# files starting with $b in $srcdir/$subdir, OPTS is a string with
# options to be passed to the compiler, DIRS and OUTPUTS are lists.
# DIRS is a list of output directories, children before parent, and
# for each element of DIRS, there should be a corresponding sublist in
# OUTPUTS. If OUTPUTS has an additional trailing sublist, that's the
# output list for the current directory. Each element of the sublists
# in OUTPUT is a file name or glob pattern to be checked for; a name
# starting with a dash or a period is taken as a suffix for $b; with a
# double dash, or a dash followed by a period, the first dash is
# replaced with $b-$b; names starting with "a--" or "a-." have "$b"
# inserted after the first dash. The glob pattern may expand to more
# than one file, but then the test will pass when there any number of
# matches. So, it's safe to use for a.{out,exe}, but .{i,s,o} and
# .[iso] will pass even if only the .o is present.
proc outest { test sources opts dirs outputs } {
global b
global srcdir
global subdir
global gsplit_dwarf
set src {}
foreach s $sources {
lappend src $srcdir/$subdir/$b$s
}
foreach f [glob -nocomplain -path $b -- *] {
file delete $f
}
foreach d $dirs {
file mkdir $d
foreach f [glob -nocomplain -path $d -- *] {
file delete $d$f
}
}
set options ""
foreach opt [split $opts " "] {
append options " additional_flags=$opt"
}
# Add linker flags if we're linking
if {![string match "* -\[ESc\] *" " $opts "]} {
global link_options
append options "$link_options"
}
set gcc_output [gcc_target_compile $src "" none "$options"]
set outs {}
foreach d $dirs olist $outputs {
foreach og $olist {
if { [string index $og 0] == "-" } then {
if { [string index $og 1] == "-" \
|| [string index $og 1] == "." } then {
set o "$b-$b[string range $og 1 end]"
} else {
set o "$b$og"
}
} elseif { [string index $og 0] == "." } then {
set o "$b$og"
} elseif { [string range $og 0 2] == "a--" } then {
set o "a-$b-[string range $og 3 end]"
} elseif { [string range $og 0 2] == "a-." } then {
set o "a-$b.[string range $og 3 end]"
} else {
set o "$og"
}
if { "$gsplit_dwarf" == "" \
&& [string match "*.dwo" "$og"] } then {
continue
}
if { [file exists $d$o] } then {
pass "$test: $d$o"
file delete $d$o
} else {
set ogl [glob -nocomplain -path $d -- $o]
if { $ogl != {} } {
pass "$test: $d$o"
file delete $ogl
} else {
fail "$test: $d$o"
}
}
}
foreach ol [glob -nocomplain -path $d$b -- *] {
lappend outs $ol
}
foreach ol [glob -nocomplain -path $d -- a{-,.}*] {
lappend outs $ol
}
}
foreach f $outs {
file delete $f
}
foreach d $dirs {
file delete -force $d
}
if { [llength $outs] == 0 } then {
pass "$test: extra"
} else {
fail "$test: extra\n$outs"
}
if { [string equal "$gcc_output" ""] } then {
pass "$test: std out"
} else {
fail "$test: std out\n$gcc_output"
}
}
set sing {-0.c}
set mult {-1.c -2.c}
# Driver-chosen outputs.
outest "$b asm default 1" $sing "-S" {} {{-0.s}}
outest "$b asm default 2" $mult "-S" {} {{-1.s -2.s}}
outest "$b obj default 1" $sing "-c" {} {{-0.o}}
outest "$b obj default 2" $mult "-c" {} {{-1.o -2.o}}
outest "$b exe default 1" $sing "" {} {{a.{out,exe}}}
outest "$b exe default 2" $mult "" {} {{a.{out,exe}}}
# Driver-chosen aux outputs.
outest "$b asm savetmp 1" $sing "-S -save-temps" {} {{-0.i -0.s}}
outest "$b asm savetmp 2" $mult "-S -save-temps" {} {{-1.i -1.s -2.i -2.s}}
outest "$b obj savetmp unnamed1" $sing "-c -save-temps" {} {{-0.i -0.s -0.o}}
outest "$b obj savetmp unnamed2" $mult "-c -save-temps" {} {{-1.i -1.s -1.o -2.i -2.s -2.o}}
# Aux outputs computed within the driver, based on output name (and
# input).
outest "$b cpp savetmp named0" $sing "-E -o $b-0.i -save-temps" {} {{-0.i}}
outest "$b asm savetmp named0" $sing "-S -o $b-0.s -save-temps" {} {{-0.i -0.s}}
outest "$b obj savetmp named0" $sing "-c -o $b-0.o -save-temps" {} {{-0.i -0.s -0.o}}
outest "$b cpp savetmp namedb" $sing "-E -o $b.i -save-temps" {} {{.i}}
outest "$b asm savetmp namedb" $sing "-S -o $b.s -save-temps" {} {{.i .s}}
outest "$b obj savetmp namedb" $sing "-c -o $b.o -save-temps" {} {{.i .s .o}}
# When linking, the executable name gets prepended to aux output
# basenames, except when executable and single input share the same
# basename.
outest "$b exe savetmp unnamed1" $sing "-save-temps" {} {{a--0.i a--0.s a--0.o a.{out,exe}}}
outest "$b exe savetmp unnamed2" $mult "-save-temps" {} {{a--1.i a--1.s a--1.o a--2.i a--2.s a--2.o a.{out,exe}}}
outest "$b exe savetmp named0" $sing "-o $b-0.exe -save-temps" {} {{-0.i -0.s -0.o -0.exe}}
outest "$b exe savetmp namedb" $sing "-o $b.exe -save-temps" {} {{--0.i --0.s --0.o .exe}}
outest "$b exe savetmp named2" $mult "-o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .exe}}
# Setting the main output to a dir selects it as the default aux&dump
# location.
outest "$b cpp savetmp namedir0" $sing "-E -o o/$b-0.i -save-temps" {o/} {{-0.i} {}}
outest "$b asm savetmp namedir0" $sing "-S -o o/$b-0.s -save-temps" {o/} {{-0.i -0.s} {}}
outest "$b obj savetmp namedir0" $sing "-c -o o/$b-0.o -save-temps" {o/} {{-0.i -0.s -0.o} {}}
outest "$b cpp savetmp namedir" $sing "-E -o o/$b.i -save-temps" {o/} {{.i} {}}
outest "$b asm savetmp namedir" $sing "-S -o o/$b.s -save-temps" {o/} {{.i .s} {}}
outest "$b obj savetmp namedir" $sing "-c -o o/$b.o -save-temps" {o/} {{.i .s .o} {}}
outest "$b exe savetmp namedir0" $sing "-o o/$b-0.exe -save-temps" {o/} {{-0.i -0.s -0.o -0.exe} {}}
outest "$b exe savetmp namedirb" $sing "-o o/$b.exe -save-temps" {o/} {{--0.i --0.s --0.o .exe} {}}
outest "$b exe savetmp namedir2" $mult "-o o/$b.exe -save-temps" {o/} {{--1.i --1.s --1.o --2.i --2.s --2.o .exe} {}}
# -save-temps=cwd overrides the aux output location to the current dir.
outest "$b obj savecwd unnamed1" $sing "-c -save-temps=cwd" {} {{-0.i -0.s -0.o}}
outest "$b obj savecwd unnamed2" $mult "-c -save-temps=cwd" {} {{-1.i -1.s -1.o -2.i -2.s -2.o}}
outest "$b cpp savecwd named0" $sing "-E -o $b-0.i -save-temps=cwd" {} {{-0.i}}
outest "$b asm savecwd named0" $sing "-S -o $b-0.s -save-temps=cwd" {} {{-0.i -0.s}}
outest "$b obj savecwd named0" $sing "-c -o $b-0.o -save-temps=cwd" {} {{-0.i -0.s -0.o}}
outest "$b cpp savecwd namedb" $sing "-E -o $b.i -save-temps=cwd" {} {{.i}}
outest "$b asm savecwd namedb" $sing "-S -o $b.s -save-temps=cwd" {} {{.i .s}}
outest "$b obj savecwd namedb" $sing "-c -o $b.o -save-temps=cwd" {} {{.i .s .o}}
outest "$b exe savecwd unnamed1" $sing "-save-temps=cwd" {} {{a--0.i a--0.s a--0.o a.{out,exe}}}
outest "$b exe savecwd unnamed2" $mult "-save-temps=cwd" {} {{a--1.i a--1.s a--1.o a--2.i a--2.s a--2.o a.{out,exe}}}
outest "$b exe savecwd named0" $sing "-o $b-0.exe -save-temps=cwd" {} {{-0.i -0.s -0.o -0.exe}}
outest "$b exe savecwd namedb" $sing "-o $b.exe -save-temps=cwd" {} {{--0.i --0.s --0.o .exe}}
outest "$b exe savecwd named2" $mult "-o $b.exe -save-temps=cwd" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .exe}}
outest "$b cpp savecwd namedir0" $sing "-E -o o/$b-0.i -save-temps=cwd" {o/} {{-0.i} {}}
outest "$b asm savecwd namedir0" $sing "-S -o o/$b-0.s -save-temps=cwd" {o/} {{-0.s} {-0.i}}
outest "$b obj savecwd namedir0" $sing "-c -o o/$b-0.o -save-temps=cwd" {o/} {{-0.o} {-0.i -0.s}}
outest "$b cpp savecwd namedir" $sing "-E -o o/$b.i -save-temps=cwd" {o/} {{.i} {}}
outest "$b asm savecwd namedir" $sing "-S -o o/$b.s -save-temps=cwd" {o/} {{.s} {.i}}
outest "$b obj savecwd namedir" $sing "-c -o o/$b.o -save-temps=cwd" {o/} {{.o} {.i .s}}
outest "$b exe savecwd namedir0" $sing "-o o/$b-0.exe -save-temps=cwd" {o/} {{-0.exe} {-0.i -0.s -0.o}}
outest "$b exe savecwd namedirb" $sing "-o o/$b.exe -save-temps=cwd" {o/} {{.exe} {--0.i --0.s --0.o}}
outest "$b exe savecwd namedir2" $mult "-o o/$b.exe -save-temps=cwd" {o/} {{.exe} {--1.i --1.s --1.o --2.i --2.s --2.o}}
# -save-temps=obj overrides the aux output location to that of the
# main output
outest "$b obj saveobj unnamed1" $sing "-c -save-temps=obj" {} {{-0.i -0.s -0.o}}
outest "$b obj saveobj unnamed2" $mult "-c -save-temps=obj" {} {{-1.i -1.s -1.o -2.i -2.s -2.o}}
outest "$b cpp saveobj named0" $sing "-E -o $b-0.i -save-temps=obj" {} {{-0.i}}
outest "$b asm saveobj named0" $sing "-S -o $b-0.s -save-temps=obj" {} {{-0.i -0.s}}
outest "$b obj saveobj named0" $sing "-c -o $b-0.o -save-temps=obj" {} {{-0.i -0.s -0.o}}
outest "$b cpp saveobj namedb" $sing "-E -o $b.i -save-temps=obj" {} {{.i}}
outest "$b asm saveobj namedb" $sing "-S -o $b.s -save-temps=obj" {} {{.i .s}}
outest "$b obj saveobj namedb" $sing "-c -o $b.o -save-temps=obj" {} {{.i .s .o}}
outest "$b exe saveobj unnamed1" $sing "-save-temps=obj" {} {{a--0.i a--0.s a--0.o a.{out,exe}}}
outest "$b exe saveobj unnamed2" $mult "-save-temps=obj" {} {{a--1.i a--1.s a--1.o a--2.i a--2.s a--2.o a.{out,exe}}}
outest "$b exe saveobj named0" $sing "-o $b-0.exe -save-temps=obj" {} {{-0.i -0.s -0.o -0.exe}}
outest "$b exe saveobj namedb" $sing "-o $b.exe -save-temps=obj" {} {{--0.i --0.s --0.o .exe}}
outest "$b exe saveobj named2" $mult "-o $b.exe -save-temps=obj" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .exe}}
outest "$b cpp saveobj namedir0" $sing "-E -o o/$b-0.i -save-temps=obj" {o/} {{-0.i} {}}
outest "$b asm saveobj namedir0" $sing "-S -o o/$b-0.s -save-temps=obj" {o/} {{-0.i -0.s} {}}
outest "$b obj saveobj namedir0" $sing "-c -o o/$b-0.o -save-temps=obj" {o/} {{-0.i -0.s -0.o} {}}
outest "$b cpp saveobj namedir" $sing "-E -o o/$b.i -save-temps=obj" {o/} {{.i} {}}
outest "$b asm saveobj namedir" $sing "-S -o o/$b.s -save-temps=obj" {o/} {{.i .s} {}}
outest "$b obj saveobj namedir" $sing "-c -o o/$b.o -save-temps=obj" {o/} {{.i .s .o} {}}
outest "$b exe saveobj namedir0" $sing "-o o/$b-0.exe -save-temps=obj" {o/} {{-0.i -0.s -0.o -0.exe} {}}
outest "$b exe saveobj namedirb" $sing "-o o/$b.exe -save-temps=obj" {o/} {{--0.i --0.s --0.o .exe} {}}
outest "$b exe saveobj namedir2" $mult "-o o/$b.exe -save-temps=obj" {o/} {{--1.i --1.s --1.o --2.i --2.s --2.o .exe} {}}
# Check -dumpdir overriding by -save-temps=*, and -save-temps
# non-overriding, with one catch: the presence of a given dumpdir,
# even if ultimately overridden, still disables the prepending of the
# executable basename to the aux&dump output basenames (or rather the
# appending of the executable basename to the dumpdir).
outest "$b exe sobjovr namedir0" $sing "-o o/$b-0.exe -dumpdir no/ -save-temps=obj -save-temps" {o/} {{-0.i -0.s -0.o -0.exe} {}}
outest "$b exe sobjovr namedirb" $sing "-o o/$b.exe -dumpdir no/ -save-temps=obj -save-temps" {o/} {{-0.i -0.s -0.o .exe} {}}
outest "$b exe sobjovr namedir2" $mult "-o o/$b.exe -dumpdir no/ -save-temps=obj -save-temps" {o/} {{-1.i -1.s -1.o -2.i -2.s -2.o .exe} {}}
outest "$b exe scwdovr namedir0" $sing "-o o/$b-0.exe -dumpdir o/ -save-temps=cwd -save-temps" {o/} {{-0.exe} {-0.i -0.s -0.o}}
outest "$b exe scwdovr namedirb" $sing "-o o/$b.exe -dumpdir o/ -save-temps=cwd -save-temps" {o/} {{.exe} {-0.i -0.s -0.o}}
outest "$b exe scwdovr namedir2" $mult "-o o/$b.exe -dumpdir o/ -save-temps=cwd -save-temps" {o/} {{.exe} {-1.i -1.s -1.o -2.i -2.s -2.o}}
outest "$b exe ddstovr namedir0" $sing "-o $b-0.exe -dumpdir o/ -save-temps" {o/} {{-0.i -0.s -0.o} {-0.exe}}
outest "$b exe ddstovr namedirb" $sing "-o $b.exe -dumpdir o/ -save-temps" {o/} {{-0.i -0.s -0.o} {.exe}}
outest "$b exe ddstovr namedir2" $mult "-o $b.exe -dumpdir o/ -save-temps" {o/} {{-1.i -1.s -1.o -2.i -2.s -2.o} {.exe}}
# Check -dumpdir prevailing over -save-temps*. Even though -dumpdir
# overrides the -save-temps=* directory selection, -save-temps remains
# enabled.
outest "$b exe soddovr namedir0" $sing "-o o/$b-0.exe -save-temps=obj -dumpdir ./" {o/} {{-0.exe} {-0.i -0.s -0.o}}
outest "$b exe soddovr namedirb" $sing "-o o/$b.exe -save-temps=obj -dumpdir ./" {o/} {{.exe} {-0.i -0.s -0.o}}
outest "$b exe soddovr namedir2" $mult "-o o/$b.exe -save-temps=obj -dumpdir ./" {o/} {{.exe} {-1.i -1.s -1.o -2.i -2.s -2.o}}
outest "$b exe scddovr namedir0" $sing "-o o/$b-0.exe -save-temps=cwd -dumpdir o/" {o/} {{-0.i -0.s -0.o -0.exe} {}}
outest "$b exe scddovr namedirb" $sing "-o o/$b.exe -save-temps=cwd -dumpdir o/" {o/} {{-0.i -0.s -0.o .exe} {}}
outest "$b exe scddovr namedir2" $mult "-o o/$b.exe -save-temps=cwd -dumpdir o/" {o/} {{-1.i -1.s -1.o -2.i -2.s -2.o .exe} {}}
outest "$b exe ddstovr namedir0" $sing "-o $b-0.exe -save-temps -dumpdir o/" {o/} {{-0.i -0.s -0.o} {-0.exe}}
outest "$b exe ddstovr namedirb" $sing "-o $b.exe -save-temps -dumpdir o/" {o/} {{-0.i -0.s -0.o} {.exe}}
outest "$b exe ddstovr namedir2" $mult "-o $b.exe -save-temps -dumpdir o/" {o/} {{-1.i -1.s -1.o -2.i -2.s -2.o} {.exe}}
# Compiler- and driver-generated aux and dump outputs.
# -fdump-rtl-final creates a .c.???r.final dump in the compiler.
# -fstack-usage creates a .su aux output in the compiler.
# $gsplit_dwarf extracts a .dwo aux output from the .o in the driver.
outest "$b asm auxdump 1" $sing "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{-0.c.???r.final -0.su -0.s}}
outest "$b asm auxdump 2" $mult "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{-1.c.???r.final -1.su -1.s -2.c.???r.final -2.su -2.s}}
outest "$b obj auxdump unnamed1" $sing "-c -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{-0.c.???r.final -0.su -0.dwo -0.o}}
outest "$b obj auxdump unnamed2" $mult "-c -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{-1.c.???r.final -1.su -1.dwo -1.o -2.c.???r.final -2.su -2.dwo -2.o}}
outest "$b cpp auxdump named0" $sing "-E -o $b-0.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{-0.i}}
outest "$b asm auxdump named0" $sing "-S -o $b-0.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{-0.c.???r.final -0.su -0.s}}
outest "$b obj auxdump named0" $sing "-c -o $b-0.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{-0.c.???r.final -0.su -0.dwo -0.o}}
outest "$b cpp auxdump namedb" $sing "-E -o $b.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{.i}}
outest "$b asm auxdump namedb" $sing "-S -o $b.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{.c.???r.final .su .s}}
outest "$b obj auxdump namedb" $sing "-c -o $b.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{.c.???r.final .su .dwo .o}}
outest "$b exe auxdump unnamed1" $sing "-g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{a--0.c.???r.final a--0.su a--0.dwo a.{out,exe}}}
outest "$b exe auxdump unnamed2" $mult "-g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{a--1.c.???r.final a--1.su a--1.dwo a--2.c.???r.final a--2.su a--2.dwo a.{out,exe}}}
outest "$b exe auxdump named0" $sing "-o $b-0.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{-0.c.???r.final -0.su -0.dwo -0.exe}}
outest "$b exe auxdump namedb" $sing "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{--0.c.???r.final --0.su --0.dwo .exe}}
outest "$b exe auxdump named2" $mult "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo .exe}}
outest "$b cpp auxdump namedir0" $sing "-E -o o/$b-0.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {o/} {{-0.i} {}}
outest "$b asm auxdump namedir0" $sing "-S -o o/$b-0.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {o/} {{-0.c.???r.final -0.su -0.s} {}}
outest "$b obj auxdump namedir0" $sing "-c -o o/$b-0.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {o/} {{-0.c.???r.final -0.su -0.dwo -0.o} {}}
outest "$b cpp auxdump namedir" $sing "-E -o o/$b.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {o/} {{.i} {}}
outest "$b asm auxdump namedir" $sing "-S -o o/$b.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {o/} {{.c.???r.final .su .s} {}}
outest "$b obj auxdump namedir" $sing "-c -o o/$b.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {o/} {{.c.???r.final .su .dwo .o} {}}
outest "$b exe auxdump namedir0" $sing "-o o/$b-0.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {o/} {{-0.c.???r.final -0.su -0.dwo -0.exe} {}}
outest "$b exe auxdump namedirb" $sing "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {o/} {{--0.c.???r.final --0.su --0.dwo .exe} {}}
outest "$b exe auxdump namedir2" $mult "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf" {o/} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo .exe} {}}
# Check that -save-temps doesn't break compiler aux or dumps as it
# changes temp file names.
outest "$b asm auxdmps 1" $sing "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {} {{-0.i -0.c.???r.final -0.su -0.s}}
outest "$b asm auxdmps 2" $mult "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {} {{-1.i -1.c.???r.final -1.su -1.s -2.i -2.c.???r.final -2.su -2.s}}
outest "$b obj auxdmps unnamed1" $sing "-c -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {} {{-0.i -0.c.???r.final -0.su -0.s -0.dwo -0.o}}
outest "$b obj auxdmps unnamed2" $mult "-c -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {} {{-1.i -1.c.???r.final -1.su -1.s -1.dwo -1.o -2.i -2.c.???r.final -2.su -2.s -2.dwo -2.o}}
outest "$b cpp auxdmps named0" $sing "-E -o $b-0.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {} {{-0.i}}
outest "$b asm auxdmps named0" $sing "-S -o $b-0.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {} {{-0.i -0.c.???r.final -0.su -0.s}}
outest "$b obj auxdmps named0" $sing "-c -o $b-0.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {} {{-0.i -0.c.???r.final -0.su -0.s -0.dwo -0.o}}
outest "$b cpp auxdmps namedb" $sing "-E -o $b.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {} {{.i}}
outest "$b asm auxdmps namedb" $sing "-S -o $b.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {} {{.i .c.???r.final .su .s}}
outest "$b obj auxdmps namedb" $sing "-c -o $b.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {} {{.i .c.???r.final .su .s .dwo .o}}
outest "$b exe auxdmps unnamed1" $sing "-g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {} {{a--0.i a--0.c.???r.final a--0.su a--0.s a--0.dwo a--0.o a.{out,exe}}}
outest "$b exe auxdmps unnamed2" $mult "-g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {} {{a--1.i a--1.c.???r.final a--1.su a--1.s a--1.dwo a--1.o a--2.i a--2.c.???r.final a--2.su a--2.s a--2.dwo a--2.o a.{out,exe}}}
outest "$b exe auxdmps named0" $sing "-o $b-0.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {} {{-0.i -0.c.???r.final -0.su -0.s -0.dwo -0.o -0.exe}}
outest "$b exe auxdmps namedb" $sing "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {} {{--0.i --0.c.???r.final --0.su --0.s --0.dwo --0.o .exe}}
outest "$b exe auxdmps named2" $mult "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {} {{--1.i --1.c.???r.final --1.su --1.s --1.dwo --1.o --2.i --2.c.???r.final --2.su --2.s --2.dwo --2.o .exe}}
outest "$b cpp auxdmps namedir0" $sing "-E -o o/$b-0.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {o/} {{-0.i} {}}
outest "$b asm auxdmps namedir0" $sing "-S -o o/$b-0.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {o/} {{-0.i -0.c.???r.final -0.su -0.s} {}}
outest "$b obj auxdmps namedir0" $sing "-c -o o/$b-0.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {o/} {{-0.i -0.c.???r.final -0.su -0.s -0.dwo -0.o} {}}
outest "$b cpp auxdmps namedir" $sing "-E -o o/$b.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {o/} {{.i} {}}
outest "$b asm auxdmps namedir" $sing "-S -o o/$b.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {o/} {{.i .c.???r.final .su .s} {}}
outest "$b obj auxdmps namedir" $sing "-c -o o/$b.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {o/} {{.i .c.???r.final .su .s .dwo .o} {}}
outest "$b exe auxdmps namedir0" $sing "-o o/$b-0.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {o/} {{-0.i -0.c.???r.final -0.su -0.s -0.dwo -0.o -0.exe} {}}
outest "$b exe auxdmps namedirb" $sing "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {o/} {{--0.i --0.c.???r.final --0.su --0.s --0.dwo --0.o .exe} {}}
outest "$b exe auxdmps namedir2" $mult "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -save-temps" {o/} {{--1.i --1.c.???r.final --1.su --1.s --1.dwo --1.o --2.i --2.c.???r.final --2.su --2.s --2.dwo --2.o .exe} {}}
# Check that dumpdir changes the location of non-primary outputs
outest "$b asm dumpdir 1" $sing "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/} {{-0.c.???r.final -0.su} {-0.s}}
outest "$b asm dumpdir 2" $mult "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/} {{-1.c.???r.final -1.su -2.c.???r.final -2.su} {-1.s -2.s}}
outest "$b obj dumpdir unnamed1" $sing "-c -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/} {{-0.c.???r.final -0.su -0.dwo} {-0.o}}
outest "$b obj dumpdir unnamed2" $mult "-c -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/} {{-1.c.???r.final -1.su -1.dwo -2.c.???r.final -2.su -2.dwo} {-1.o -2.o}}
outest "$b cpp dumpdir named0" $sing "-E -o $b-0.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/} {{} {-0.i}}
outest "$b asm dumpdir named0" $sing "-S -o $b-0.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/} {{-0.c.???r.final -0.su} {-0.s}}
outest "$b obj dumpdir named0" $sing "-c -o $b-0.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/} {{-0.c.???r.final -0.su -0.dwo} {-0.o}}
outest "$b cpp dumpdir namedb" $sing "-E -o $b.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/} {{} {.i}}
outest "$b asm dumpdir namedb" $sing "-S -o $b.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/} {{.c.???r.final .su} {.s}}
outest "$b obj dumpdir namedb" $sing "-c -o $b.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/} {{.c.???r.final .su .dwo} {.o}}
outest "$b exe dumpdir unnamed1" $sing "-g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/a-" {od/} {{a--0.c.???r.final a--0.su a--0.dwo} {a.{out,exe}}}
outest "$b exe dumpdir unnamed2" $mult "-g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/a-" {od/} {{a--1.c.???r.final a--1.su a--1.dwo a--2.c.???r.final a--2.su a--2.dwo} {a.{out,exe}}}
outest "$b exe dumpdir named0" $sing "-o $b-0.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/} {{-0.c.???r.final -0.su -0.dwo} {-0.exe}}
outest "$b exe dumpdir namedb" $sing "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/} {{-0.c.???r.final -0.su -0.dwo} {.exe}}
outest "$b exe dumpdir named2" $mult "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/} {{-1.c.???r.final -1.su -1.dwo -2.c.???r.final -2.su -2.dwo} {.exe}}
outest "$b exe dumpdira namedb" $sing "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/a-" {od/} {{a--0.c.???r.final a--0.su a--0.dwo} {.exe}}
outest "$b exe dumpdira named2" $mult "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/a-" {od/} {{a--1.c.???r.final a--1.su a--1.dwo a--2.c.???r.final a--2.su a--2.dwo} {.exe}}
outest "$b exe dumpdirb namedb" $sing "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/$b-" {od/} {{--0.c.???r.final --0.su --0.dwo} {.exe}}
outest "$b exe dumpdirb named2" $mult "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/$b-" {od/} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo} {.exe}}
outest "$b cpp dumpdir namedir0" $sing "-E -o o/$b-0.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/ o/} {{} {-0.i} {}}
outest "$b asm dumpdir namedir0" $sing "-S -o o/$b-0.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/ o/} {{-0.c.???r.final -0.su} {-0.s} {}}
outest "$b obj dumpdir namedir0" $sing "-c -o o/$b-0.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/ o/} {{-0.c.???r.final -0.su -0.dwo} {-0.o} {}}
outest "$b cpp dumpdir namedir" $sing "-E -o o/$b.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/ o/} {{} {.i} {}}
outest "$b asm dumpdir namedir" $sing "-S -o o/$b.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/ o/} {{.c.???r.final .su} {.s} {}}
outest "$b obj dumpdir namedir" $sing "-c -o o/$b.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/ o/} {{.c.???r.final .su .dwo} {.o} {}}
outest "$b exe dumpdir namedir0" $sing "-o o/$b-0.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/ o/} {{-0.c.???r.final -0.su -0.dwo} {-0.exe} {}}
outest "$b exe dumpdir namedirb" $sing "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/ o/} {{-0.c.???r.final -0.su -0.dwo} {.exe} {}}
outest "$b exe dumpdir namedir2" $mult "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/" {od/ o/} {{-1.c.???r.final -1.su -1.dwo -2.c.???r.final -2.su -2.dwo} {.exe} {}}
outest "$b exe dumpdira namedirb" $sing "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/a-" {od/ o/} {{a--0.c.???r.final a--0.su a--0.dwo} {.exe} {}}
outest "$b exe dumpdira namedir2" $mult "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/a-" {od/ o/} {{a--1.c.???r.final a--1.su a--1.dwo a--2.c.???r.final a--2.su a--2.dwo} {.exe} {}}
outest "$b exe dumpdirb namedirb" $sing "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/$b-" {od/ o/} {{--0.c.???r.final --0.su --0.dwo} {.exe} {}}
outest "$b exe dumpdirb namedir2" $mult "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/$b-" {od/ o/} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo} {.exe} {}}
# Check that a -dumpbase with a dir component disregards the -dumpdir
# prefix. Also, start testing -dumpbase-ext to distinguish between
# aux and dump files: only the latter retain the named extension.
# -dumpbase-ext, if absent or used in combination with -dumpbase for
# an executable name, defaults to the extension of the source file.
# The specified dumpbase is combined with the dumpdir prefix when
# processing more than one input (we couldn't use the same dumpbase
# for them all), or when linking (the specified dumpbase is then used
# as prefix instead of the linker output, and a new dumpbase is
# computed per source).
outest "$b asm dbsovrdd 1" $sing "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/} {{.???r.final .su} {-0.s}}
outest "$b asm dbsovrddx 1" $sing "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b.c -dumpbase-ext .c" {od/} {{.c.???r.final .su} {-0.s}}
outest "$b asm dbsovrdd-x 1" $sing "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b.c" {od/} {{.c.???r.final .c.su} {-0.s}}
outest "$b asm dbsovrdd.x 1" $sing "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b.x" {od/} {{.x.???r.final .x.su} {-0.s}}
outest "$b asm dbsovrdd 2" $mult "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/} {{--1.c.???r.final --1.su --2.c.???r.final --2.su} {-1.s -2.s}}
outest "$b asm dbsovrddx 2" $mult "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b.x -dumpbase-ext .x" {od/} {{--1.c.???r.final --1.su --2.c.???r.final --2.su} {-1.s -2.s}}
outest "$b obj dbsovrdd unnamed1" $sing "-c -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/} {{.???r.final .su .dwo} {-0.o}}
outest "$b obj dbsovrddx unnamed1" $sing "-c -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b.c -dumpbase-ext .c" {od/} {{.c.???r.final .su .dwo} {-0.o}}
outest "$b obj dbsovrdd unnamed2" $mult "-c -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo} {-1.o -2.o}}
outest "$b cpp dbsovrdd named0" $sing "-E -o $b-0.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/} {{} {-0.i}}
outest "$b asm dbsovrdd named0" $sing "-S -o $b-0.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/} {{.???r.final .su} {-0.s}}
outest "$b obj dbsovrdd named0" $sing "-c -o $b-0.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/} {{.???r.final .su .dwo} {-0.o}}
outest "$b cpp dbsovrdd namedb" $sing "-E -o $b.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/} {{} {.i}}
outest "$b asm dbsovrdd namedb" $sing "-S -o $b.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/} {{.???r.final .su} {.s}}
outest "$b obj dbsovrdd namedb" $sing "-c -o $b.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/} {{.???r.final .su .dwo} {.o}}
# Nit: -dumpdir affects whether the specified dumpbase is combined
# into dumpdir or taken as the output basename, even if dumpbase will
# ultimately override it.
outest "$b exe dbsovrdd unnamed1" $sing "-g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/} {{.???r.final .su .dwo} {a.{out,exe}}}
outest "$b exe dbsovrdd unnamed2" $mult "-g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/a" {od/} {{a--1.c.???r.final a--1.su a--1.dwo a--2.c.???r.final a--2.su a--2.dwo} {a.{out,exe}}}
outest "$b exe dbsovrdd named0" $sing "-o $b-0.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/} {{.???r.final .su .dwo} {-0.exe}}
outest "$b exe dbsovrdd namedb" $sing "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b.exe -dumpbase-ext .exe" {od/} {{.exe.???r.final .su .dwo} {.exe}}
outest "$b exe dbsovrdd named2" $mult "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo} {.exe}}
outest "$b exe dbsovrdda namedb" $sing "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/a" {od/} {{a.???r.final a.su a.dwo} {.exe}}
outest "$b exe dbsovrddac namedb" $sing "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/a.c -dumpbase-ext .c" {od/} {{a.c.???r.final a.su a.dwo} {.exe}}
outest "$b exe dbsovrdda named2" $mult "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/a" {od/} {{a--1.c.???r.final a--1.su a--1.dwo a--2.c.???r.final a--2.su a--2.dwo} {.exe}}
outest "$b cpp dbsovrdd namedir0" $sing "-E -o o/$b-0.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/ o/} {{} {-0.i} {}}
outest "$b asm dbsovrdd namedir0" $sing "-S -o o/$b-0.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/ o/} {{.???r.final .su} {-0.s} {}}
outest "$b obj dbsovrdd namedir0" $sing "-c -o o/$b-0.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/ o/} {{.???r.final .su .dwo} {-0.o} {}}
outest "$b cpp dbsovrdd namedir" $sing "-E -o o/$b.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/ o/} {{} {.i} {}}
outest "$b asm dbsovrdd namedir" $sing "-S -o o/$b.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/ o/} {{.???r.final .su} {.s} {}}
outest "$b obj dbsovrdd namedir" $sing "-c -o o/$b.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/ o/} {{.???r.final .su .dwo} {.o} {}}
outest "$b exe dbsovrdd namedir0" $sing "-o o/$b-0.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/ o/} {{.???r.final .su .dwo} {-0.exe} {}}
outest "$b exe dbsovrdd namedirb" $sing "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b.exe -dumpbase-ext .exe" {od/ o/} {{.exe.???r.final .su .dwo} {.exe} {}}
outest "$b exe dbsovrdd namedir2" $mult "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/$b" {od/ o/} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo} {.exe} {}}
outest "$b exe dbsovrdda namedirb" $sing "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/a" {od/ o/} {{a.???r.final a.su a.dwo} {.exe} {}}
outest "$b exe dbsovrdda namedir2" $mult "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir ./ -dumpbase od/a" {od/ o/} {{a--1.c.???r.final a--1.su a--1.dwo a--2.c.???r.final a--2.su a--2.dwo} {.exe} {}}
# Check that a -dumpbase without a dir component adds to the -dumpdir
# prefix.
outest "$b asm dbswthdd 1" $sing "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/} {{.???r.final .su} {-0.s}}
outest "$b asm dbswthddx 1" $sing "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b.c -dumpbase-ext .c" {od/} {{.c.???r.final .su} {-0.s}}
outest "$b asm dbswthdd-x 1" $sing "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b.c" {od/} {{.c.???r.final .c.su} {-0.s}}
outest "$b asm dbswthdd.x 1" $sing "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b.x" {od/} {{.x.???r.final .x.su} {-0.s}}
outest "$b asm dbswthdd 2" $mult "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/} {{--1.c.???r.final --1.su --2.c.???r.final --2.su} {-1.s -2.s}}
outest "$b asm dbswthddx 2" $mult "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b.x -dumpbase-ext .x" {od/} {{--1.c.???r.final --1.su --2.c.???r.final --2.su} {-1.s -2.s}}
outest "$b obj dbswthdd unnamed1" $sing "-c -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/} {{.???r.final .su .dwo} {-0.o}}
outest "$b obj dbswthddx unnamed1" $sing "-c -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b.c -dumpbase-ext .c" {od/} {{.c.???r.final .su .dwo} {-0.o}}
outest "$b obj dbswthdd unnamed2" $mult "-c -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo} {-1.o -2.o}}
outest "$b cpp dbswthdd named0" $sing "-E -o $b-0.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/} {{} {-0.i}}
outest "$b asm dbswthdd named0" $sing "-S -o $b-0.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/} {{.???r.final .su} {-0.s}}
outest "$b obj dbswthdd named0" $sing "-c -o $b-0.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/} {{.???r.final .su .dwo} {-0.o}}
outest "$b cpp dbswthdd namedb" $sing "-E -o $b.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/} {{} {.i}}
outest "$b asm dbswthdd namedb" $sing "-S -o $b.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/} {{.???r.final .su} {.s}}
outest "$b obj dbswthdd namedb" $sing "-c -o $b.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/} {{.???r.final .su .dwo} {.o}}
# Nitty details: -dumpdir affects whether the specified dumpbase is
# combined into dumpdir or taken as the output basename, even if
# dumpbase will ultimately override it.
outest "$b exe dbswthdd unnamed1" $sing "-g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/} {{.???r.final .su .dwo} {a.{out,exe}}}
outest "$b exe dbswthdd unnamed2" $mult "-g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase a" {od/} {{a--1.c.???r.final a--1.su a--1.dwo a--2.c.???r.final a--2.su a--2.dwo} {a.{out,exe}}}
outest "$b exe dbswthdd named0" $sing "-o $b-0.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/} {{.???r.final .su .dwo} {-0.exe}}
outest "$b exe dbswthdd namedb" $sing "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b.exe -dumpbase-ext .exe" {od/} {{.exe.???r.final .su .dwo} {.exe}}
outest "$b exe dbswthdd named2" $mult "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo} {.exe}}
outest "$b exe dbswthdda namedb" $sing "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase a" {od/} {{a.???r.final a.su a.dwo} {.exe}}
outest "$b exe dbswthddac namedb" $sing "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase a.c -dumpbase-ext .c" {od/} {{a.c.???r.final a.su a.dwo} {.exe}}
outest "$b exe dbswthdda named2" $mult "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase a" {od/} {{a--1.c.???r.final a--1.su a--1.dwo a--2.c.???r.final a--2.su a--2.dwo} {.exe}}
outest "$b cpp dbswthdd namedir0" $sing "-E -o o/$b-0.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/ o/} {{} {-0.i} {}}
outest "$b asm dbswthdd namedir0" $sing "-S -o o/$b-0.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/ o/} {{.???r.final .su} {-0.s} {}}
outest "$b obj dbswthdd namedir0" $sing "-c -o o/$b-0.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/ o/} {{.???r.final .su .dwo} {-0.o} {}}
outest "$b cpp dbswthdd namedir" $sing "-E -o o/$b.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/ o/} {{} {.i} {}}
outest "$b asm dbswthdd namedir" $sing "-S -o o/$b.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/ o/} {{.???r.final .su} {.s} {}}
outest "$b obj dbswthdd namedir" $sing "-c -o o/$b.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/ o/} {{.???r.final .su .dwo} {.o} {}}
outest "$b exe dbswthdd namedir0" $sing "-o o/$b-0.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/ o/} {{.???r.final .su .dwo} {-0.exe} {}}
outest "$b exe dbswthdd namedirb" $sing "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b.exe -dumpbase-ext .exe" {od/ o/} {{.exe.???r.final .su .dwo} {.exe} {}}
outest "$b exe dbswthdd namedir2" $mult "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase $b" {od/ o/} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo} {.exe} {}}
outest "$b exe dbswthdda namedirb" $sing "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase a" {od/ o/} {{a.???r.final a.su a.dwo} {.exe} {}}
outest "$b exe dbswthdda namedir2" $mult "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpdir od/ -dumpbase a" {od/ o/} {{a--1.c.???r.final a--1.su a--1.dwo a--2.c.???r.final a--2.su a--2.dwo} {.exe} {}}
# Check for the minor differences when -dumpbase is used without
# -dumpdir. The main difference between dbwoutdd and dbswthdd tests
# is in the single-input link tests: with the dump dir/ prefix moved
# to dumpbase, and without -dumpdir we end up using -dumpbase as the
# executable prefix rather than as the dumpbase for the single input.
outest "$b asm dbwoutdd 1" $sing "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/} {{.???r.final .su} {-0.s}}
outest "$b asm dbwoutddx 1" $sing "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b.c -dumpbase-ext .c" {od/} {{.c.???r.final .su} {-0.s}}
outest "$b asm dbwoutdd-x 1" $sing "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b.c" {od/} {{.c.???r.final .c.su} {-0.s}}
outest "$b asm dbwoutdd.x 1" $sing "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b.x" {od/} {{.x.???r.final .x.su} {-0.s}}
outest "$b asm dbwoutdd 2" $mult "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/} {{--1.c.???r.final --1.su --2.c.???r.final --2.su} {-1.s -2.s}}
outest "$b asm dbwoutddx 2" $mult "-S -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b.x -dumpbase-ext .x" {od/} {{--1.c.???r.final --1.su --2.c.???r.final --2.su} {-1.s -2.s}}
outest "$b obj dbwoutdd unnamed1" $sing "-c -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/} {{.???r.final .su .dwo} {-0.o}}
outest "$b obj dbwoutddx unnamed1" $sing "-c -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b.c -dumpbase-ext .c" {od/} {{.c.???r.final .su .dwo} {-0.o}}
outest "$b obj dbwoutdd unnamed2" $mult "-c -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo} {-1.o -2.o}}
outest "$b cpp dbwoutdd named0" $sing "-E -o $b-0.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/} {{} {-0.i}}
outest "$b asm dbwoutdd named0" $sing "-S -o $b-0.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/} {{.???r.final .su} {-0.s}}
outest "$b obj dbwoutdd named0" $sing "-c -o $b-0.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/} {{.???r.final .su .dwo} {-0.o}}
outest "$b cpp dbwoutdd namedb" $sing "-E -o $b.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/} {{} {.i}}
outest "$b asm dbwoutdd namedb" $sing "-S -o $b.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/} {{.???r.final .su} {.s}}
outest "$b obj dbwoutdd namedb" $sing "-c -o $b.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/} {{.???r.final .su .dwo} {.o}}
outest "$b exe dbwoutdd unnamed1" $sing "-g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/} {{--0.c.???r.final --0.su --0.dwo} {a.{out,exe}}}
outest "$b exe dbwoutdd unnamed2" $mult "-g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/a" {od/} {{a--1.c.???r.final a--1.su a--1.dwo a--2.c.???r.final a--2.su a--2.dwo} {a.{out,exe}}}
outest "$b exe dbwoutdd named0" $sing "-o $b-0.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/} {{--0.c.???r.final --0.su --0.dwo} {-0.exe}}
outest "$b exe dbwoutdd named0d" $sing "-o od/$b-0.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase $b" {od/} {{--0.c.???r.final --0.su --0.dwo -0.exe} {}}
outest "$b exe dbwoutdd namedb" $sing "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b.exe -dumpbase-ext .exe" {od/} {{--0.c.???r.final --0.su --0.dwo} {.exe}}
outest "$b exe dbwoutdd named2" $mult "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo} {.exe}}
outest "$b exe dbwoutdda namedb" $sing "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/a" {od/} {{a--0.c.???r.final a--0.su a--0.dwo} {.exe}}
outest "$b exe dbwoutddac namedb" $sing "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/a.c -dumpbase-ext .c" {od/} {{a--0.c.???r.final a--0.su a--0.dwo} {.exe}}
outest "$b exe dbwoutdda named2" $mult "-o $b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/a" {od/} {{a--1.c.???r.final a--1.su a--1.dwo a--2.c.???r.final a--2.su a--2.dwo} {.exe}}
outest "$b cpp dbwoutdd namedir0" $sing "-E -o o/$b-0.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/ o/} {{} {-0.i} {}}
outest "$b asm dbwoutdd namedir0" $sing "-S -o o/$b-0.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/ o/} {{.???r.final .su} {-0.s} {}}
outest "$b obj dbwoutdd namedir0" $sing "-c -o o/$b-0.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/ o/} {{.???r.final .su .dwo} {-0.o} {}}
outest "$b cpp dbwoutdd namedir" $sing "-E -o o/$b.i -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/ o/} {{} {.i} {}}
outest "$b asm dbwoutdd namedir" $sing "-S -o o/$b.s -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/ o/} {{.???r.final .su} {.s} {}}
outest "$b obj dbwoutdd namedir" $sing "-c -o o/$b.o -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/ o/} {{.???r.final .su .dwo} {.o} {}}
outest "$b exe dbwoutdd namedir0" $sing "-o o/$b-0.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/ o/} {{--0.c.???r.final --0.su --0.dwo} {-0.exe} {}}
outest "$b exe dbwoutdd namedirb" $sing "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b.exe -dumpbase-ext .exe" {od/ o/} {{--0.c.???r.final --0.su --0.dwo} {.exe} {}}
outest "$b exe dbwoutdd namedir2" $mult "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/$b" {od/ o/} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo} {.exe} {}}
outest "$b exe dbwoutdda namedirb" $sing "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/a" {od/ o/} {{a--0.c.???r.final a--0.su a--0.dwo} {.exe} {}}
outest "$b exe dbwoutdda namedir2" $mult "-o o/$b.exe -g -fdump-rtl-final -fstack-usage $gsplit_dwarf -dumpbase od/a" {od/ o/} {{a--1.c.???r.final a--1.su a--1.dwo a--2.c.???r.final a--2.su a--2.dwo} {.exe} {}}
# -fcompare-debug
outest "$b obj compare-debug" $sing "-c -fcompare-debug -fdump-rtl-final -fstack-usage $gsplit_dwarf -fdump-final-insns" {} {{-0.c.???r.final -0.su -0.c.gkd -0.gk.c.???r.final -0.dwo -0.o}}
outest "$b obj compare-debug save-temps" $sing "-c -fcompare-debug -save-temps -fdump-rtl-final -fstack-usage $gsplit_dwarf -fdump-final-insns" {} {{-0.c.???r.final -0.su -0.i -0.c.gkd -0.s -0.gk.i -0.gk.c.???r.final -0.gk.c.gkd -0.dwo -0.o}}
# -flto
outest "$b lto sing unnamed" $sing "-O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{a--0.c.???i.icf a.wpa.???i.icf a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.{out,exe}}}
outest "$b lto mult unnamed" $mult "-O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{a--1.c.???i.icf a--2.c.???i.icf a.wpa.???i.icf a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.{out,exe}}}
outest "$b lto sing named" $sing "-o $b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{--0.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe}}
outest "$b lto mult named" $mult "-o $b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{--1.c.???i.icf --2.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe}}
outest "$b lto sing nameddir" $sing "-o dir/$b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe} {}}
outest "$b lto mult nameddir" $mult "-o dir/$b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe} {}}
# -dumpbase without -dumpdir. The trailing dumppfx dash after it is
# combined with dumpbase turns into a period when passed to lto as
# -dumpdir, because the dash is introduced by the compiler driver.
outest "$b lto sing dumpbase unnamed" $sing "-dumpbase dir/$b -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {a.{out,exe}}}
outest "$b lto mult dumpbase unnamed" $mult "-dumpbase dir/$b -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {a.{out,exe}}}
outest "$b lto sing dumpbase named" $sing "-dumpbase dir/$b -o $b-0.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {-0.exe}}
outest "$b lto mult dumpbase named" $mult "-dumpbase dir/$b -o $b-1.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {-1.exe}}
outest "$b lto sing dumpbase namedb" $sing "-dumpbase dir/$b -o $b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {.exe}}
outest "$b lto mult dumpbase namedb" $mult "-dumpbase dir/$b -o $b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {.exe}}
# -dumpdir without -dumpbase. The trailing dash in -dumpdir is given
# by the user, thus not replaced with a dot.
outest "$b lto sing dumpdir unnamed" $sing "-dumpdir dir/$b- -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.c.???i.icf -wpa.???i.icf -ltrans0.ltrans.???r.final -ltrans0.ltrans.su} {a.{out,exe}}}
outest "$b lto mult dumpdir unnamed" $mult "-dumpdir dir/$b- -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf -wpa.???i.icf -ltrans0.ltrans.???r.final -ltrans0.ltrans.su} {a.{out,exe}}}
outest "$b lto sing dumpdir named" $sing "-dumpdir dir/$b- -o $b-0.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.c.???i.icf -wpa.???i.icf -ltrans0.ltrans.???r.final -ltrans0.ltrans.su} {-0.exe}}
outest "$b lto mult dumpdir named" $mult "-dumpdir dir/$b- -o $b-1.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf -wpa.???i.icf -ltrans0.ltrans.???r.final -ltrans0.ltrans.su} {-1.exe}}
outest "$b lto sing dumpdir namedb" $sing "-dumpdir dir/$b- -o $b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.c.???i.icf -wpa.???i.icf -ltrans0.ltrans.???r.final -ltrans0.ltrans.su} {.exe}}
outest "$b lto mult dumpdir namedb" $mult "-dumpdir dir/$b- -o $b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf -wpa.???i.icf -ltrans0.ltrans.???r.final -ltrans0.ltrans.su} {.exe}}
# -dumpdir and non-overriding -dumpbase.
outest "$b lto dbswthdd sing unnamed" $sing "-dumpdir dir/ -dumpbase $b -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {a.{out,exe}}}
outest "$b lto dbswthdd mult unnamed" $mult "-dumpdir dir/ -dumpbase $b -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {a.{out,exe}}}
outest "$b lto dbswthdd sing named" $sing "-dumpdir dir/ -dumpbase $b -o $b-0.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {-0.exe}}
outest "$b lto dbswthdd mult named" $mult "-dumpdir dir/ -dumpbase $b -o $b-1.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {-1.exe}}
outest "$b lto dbswthdd sing namedb" $sing "-dumpdir dir/ -dumpbase $b -o $b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {.exe}}
outest "$b lto dbswthdd mult namedb" $mult "-dumpdir dir/ -dumpbase $b -o $b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {.exe}}
# -dumpdir and an overriding -dumpbase.
outest "$b lto dbsovrdd sing unnamed" $sing "-dumpdir ignore/ -dumpbase dir/$b -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {a.{out,exe}}}
outest "$b lto dbsovrdd mult unnamed" $mult "-dumpdir ignore/ -dumpbase dir/$b -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {a.{out,exe}}}
outest "$b lto dbsovrdd sing named" $sing "-dumpdir ignore/ -dumpbase dir/$b -o $b-0.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {-0.exe}}
outest "$b lto dbsovrdd mult named" $mult "-dumpdir ignore/ -dumpbase dir/$b -o $b-1.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {-1.exe}}
outest "$b lto dbsovrdd sing namedb" $sing "-dumpdir ignore/ -dumpbase dir/$b -o $b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {.exe}}
outest "$b lto dbsovrdd mult namedb" $mult "-dumpdir ignore/ -dumpbase dir/$b -o $b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su} {.exe}}
# Check that -dumpbase '' gets source names as dumpbases for
# compilation, and output name as dumpbase for linking, regardless of
# how many source files.
outest "$b lto sing empty dumpbase unnamed" $sing "-dumpbase \"\" -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{-0.c.???i.icf a.wpa.???i.icf a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.{out,exe}}}
outest "$b lto mult empty dumpbase unnamed" $mult "-dumpbase \"\" -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{-1.c.???i.icf -2.c.???i.icf a.wpa.???i.icf a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.{out,exe}}}
outest "$b lto sing empty dumpbase named" $sing "-dumpbase \"\" -o dir/$b-0.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-0.c.???i.icf -0.wpa.???i.icf -0.ltrans0.ltrans.???r.final -0.ltrans0.ltrans.su -0.exe} {}}
outest "$b lto mult empty dumpbase named" $mult "-dumpbase \"\" -o dir/$b-1.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-1.c.???i.icf -2.c.???i.icf -1.wpa.???i.icf -1.ltrans0.ltrans.???r.final -1.ltrans0.ltrans.su -1.exe} {}}
outest "$b lto sing empty dumpbase namedb" $sing "-dumpbase \"\" -o $b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{-0.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe}}
outest "$b lto mult empty dumpbase namedb" $mult "-dumpbase \"\" -o $b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{-1.c.???i.icf -2.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe}}
# Now with -dumpdir too.
outest "$b lto sing empty dumpbase dumpdir unnamed" $sing "-dumpdir dir/$b- -dumpbase \"\" -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.c.???i.icf -a.wpa.???i.icf -a.ltrans0.ltrans.???r.final -a.ltrans0.ltrans.su} {a.{out,exe}}}
outest "$b lto mult empty dumpbase dumpdir unnamed" $mult "-dumpdir dir/$b- -dumpbase \"\" -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf -a.wpa.???i.icf -a.ltrans0.ltrans.???r.final -a.ltrans0.ltrans.su} {a.{out,exe}}}
outest "$b lto sing empty dumpbase dumpdir named" $sing "-dumpdir dir/$b- -dumpbase \"\" -o $b-0.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.c.???i.icf --0.wpa.???i.icf --0.ltrans0.ltrans.???r.final --0.ltrans0.ltrans.su} {-0.exe}}
outest "$b lto mult empty dumpbase dumpdir named" $mult "-dumpdir dir/$b- -dumpbase \"\" -o $b-1.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf --1.wpa.???i.icf --1.ltrans0.ltrans.???r.final --1.ltrans0.ltrans.su} {-1.exe}}
outest "$b lto sing empty dumpbase dumpdir namedb" $sing "-dumpdir dir/$b- -dumpbase \"\" -o $b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.c.???i.icf -.wpa.???i.icf -.ltrans0.ltrans.???r.final -.ltrans0.ltrans.su} {.exe}}
outest "$b lto mult empty dumpbase dumpdir namedb" $mult "-dumpdir dir/$b- -dumpbase \"\" -o $b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --2.c.???i.icf -.wpa.???i.icf -.ltrans0.ltrans.???r.final -.ltrans0.ltrans.su} {.exe}}
# And also with an empty -dumpdir. That's equivalent to -dumpdir ./,
# overriding any dumpdir implied by the output.
outest "$b lto sing empty dumpdir empty dumpbase unnamed" $sing "-dumpdir \"\" -dumpbase \"\" -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{-0.c.???i.icf a.wpa.???i.icf a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.{out,exe}}}
outest "$b lto mult empty dumpdir empty dumpbase unnamed" $mult "-dumpdir \"\" -dumpbase \"\" -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{-1.c.???i.icf -2.c.???i.icf a.wpa.???i.icf a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.{out,exe}}}
outest "$b lto sing empty dumpdir empty dumpbase named" $sing "-dumpdir \"\" -dumpbase \"\" -o dir/$b-0.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-0.exe} {-0.c.???i.icf -0.wpa.???i.icf -0.ltrans0.ltrans.???r.final -0.ltrans0.ltrans.su}}
outest "$b lto mult empty dumpdir empty dumpbase named" $mult "-dumpdir \"\" -dumpbase \"\" -o dir/$b-1.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-1.exe} {-1.c.???i.icf -2.c.???i.icf -1.wpa.???i.icf -1.ltrans0.ltrans.???r.final -1.ltrans0.ltrans.su}}
outest "$b lto sing empty dumpdir empty dumpbase namedb" $sing "-dumpdir \"\" -dumpbase \"\" -o dir/$b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{.exe} {-0.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su}}
outest "$b lto mult empty dumpdir empty dumpbase namedb" $mult "-dumpdir \"\" -dumpbase \"\" -o dir/$b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{.exe} {-1.c.???i.icf -2.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su}}
# Now -flto with -save-temps, not exhaustive.
outest "$b lto st sing empty dumpbase unnamed" $sing "-dumpbase \"\" -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{-0.i -0.s -0.o -0.c.???i.icf a.lto_wrapper_args a.wpa.???i.icf a.ltrans.out a.res a.ltrans0.o a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.ltrans0.ltrans.s a.ltrans0.ltrans.o a.{out,exe}}}
outest "$b lto st mult empty dumpbase unnamed" $mult "-dumpbase \"\" -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{-1.i -1.s -1.o -1.c.???i.icf -2.i -2.s -2.o -2.c.???i.icf a.lto_wrapper_args a.wpa.???i.icf a.ltrans.out a.res a.ltrans0.o a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.ltrans0.ltrans.s a.ltrans0.ltrans.o a.{out,exe}}}
outest "$b lto st sing dumpdir empty dumpbase named" $sing "-dumpdir dir/ -dumpbase \"\" -o $b-0.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-0.i -0.s -0.o -0.c.???i.icf -0.lto_wrapper_args -0.wpa.???i.icf -0.ltrans.out -0.res -0.ltrans0.o -0.ltrans0.ltrans.???r.final -0.ltrans0.ltrans.su -0.ltrans0.ltrans.s -0.ltrans0.ltrans.o} {-0.exe}}
outest "$b lto st mult dumpdir empty dumpbase named" $mult "-dumpdir dir/ -dumpbase \"\" -o $b-1.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-1.i -1.s -1.o -1.c.???i.icf -2.i -2.s -2.o -2.c.???i.icf -1.lto_wrapper_args -1.wpa.???i.icf -1.ltrans.out -1.res -1.ltrans0.o -1.ltrans0.ltrans.???r.final -1.ltrans0.ltrans.su -1.ltrans0.ltrans.s -1.ltrans0.ltrans.o} {-1.exe}}
outest "$b lto st sing empty dumpbase namedb" $sing "-dumpbase \"\" -o dir/$b.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-0.i -0.s -0.o -0.c.???i.icf .lto_wrapper_args .wpa.???i.icf .ltrans.out .res .ltrans0.o .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .ltrans0.ltrans.s .ltrans0.ltrans.o .exe} {}}
outest "$b lto st mult empty dumpbase namedb" $mult "-dumpbase \"\" -o dir/$b.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-1.i -1.s -1.o -1.c.???i.icf -2.i -2.s -2.o -2.c.???i.icf .lto_wrapper_args .wpa.???i.icf .ltrans.out .res .ltrans0.o .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .ltrans0.ltrans.s .ltrans0.ltrans.o .exe} {}}
# lto save-temps without -dumpbase.
outest "$b lto st sing unnamed" $sing "-save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{a--0.i a--0.s a--0.o a--0.c.???i.icf a.lto_wrapper_args a.wpa.???i.icf a.ltrans.out a.res a.ltrans0.o a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.ltrans0.ltrans.s a.ltrans0.ltrans.o a.{out,exe}}}
outest "$b lto st mult unnamed" $mult "-save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{a--1.i a--1.s a--1.o a--1.c.???i.icf a--2.i a--2.s a--2.o a--2.c.???i.icf a.lto_wrapper_args a.wpa.???i.icf a.ltrans.out a.res a.ltrans0.o a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.ltrans0.ltrans.s a.ltrans0.ltrans.o a.{out,exe}}}
outest "$b lto st sing dumpdir named" $sing "-dumpdir dir/$b- -o $b-0.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.i --0.s --0.o --0.c.???i.icf -lto_wrapper_args -wpa.???i.icf -ltrans.out -res -ltrans0.o -ltrans0.ltrans.???r.final -ltrans0.ltrans.su -ltrans0.ltrans.s -ltrans0.ltrans.o} {-0.exe}}
outest "$b lto st mult dumpdir named" $mult "-dumpdir dir/$b- -o $b-1.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.i --1.s --1.o --1.c.???i.icf --2.i --2.s --2.o --2.c.???i.icf -lto_wrapper_args -wpa.???i.icf -ltrans.out -res -ltrans0.o -ltrans0.ltrans.???r.final -ltrans0.ltrans.su -ltrans0.ltrans.s -ltrans0.ltrans.o} {-1.exe}}
outest "$b lto st sing namedb" $sing "-o dir/$b.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.i --0.s --0.o --0.c.???i.icf .lto_wrapper_args .wpa.???i.icf .ltrans.out .res .ltrans0.o .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .ltrans0.ltrans.s .ltrans0.ltrans.o .exe} {}}
outest "$b lto st mult namedb" $mult "-o dir/$b.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.i --1.s --1.o --1.c.???i.icf --2.i --2.s --2.o --2.c.???i.icf .lto_wrapper_args .wpa.???i.icf .ltrans.out .res .ltrans0.o .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .ltrans0.ltrans.s .ltrans0.ltrans.o .exe} {}}
# Below are examples taken from the documentation.
# They are likely redundant with earlier test,
# but we want to make sure behavior matches the docs.
# gcc -c foo.c ...
outest "$b doc single -c !-o" $sing "-c -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{-0.c.???r.final -0.su -0.dwo -0.o}}
# gcc -c foo.c -o dir/foobar.o ...
outest "$b doc single -c +-o" $sing "-c -o dir/$b.o -fdump-rtl-final -fstack-usage $gsplit_dwarf" {dir/} {{.c.???r.final .su .dwo .o} {}}
# gcc foo.c bar.c -o dir/foobar ...
outest "$b doc double !-c -o" $mult "-o dir/$b.exe -fdump-rtl-final -fstack-usage $gsplit_dwarf" {dir/} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo .exe} {}}
# gcc foo.c -o dir/foo ...
outest "$b doc single !-c -o" $sing "-o dir/$b-0 -fdump-rtl-final -fstack-usage $gsplit_dwarf" {dir/} {{-0.c.???r.final -0.su -0.dwo -0} {}}
# gcc -save-temps -S foo.c
outest "$b doc single -S -st" $sing "-save-temps -S" {} {{-0.i -0.s}}
# gcc -save-temps -dumpbase save-foo -c foo.c
outest "$b doc single -c -st -db" $sing "-save-temps -dumpbase $b -c" {} {{.i .s -0.o}}
# gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
# -dumpdir pfx- -save-temps=cwd ...
outest "$b doc single -c -o -db" $sing "-c -o dir/$b.o -dumpbase alt/$b -dumpdir pfx- -save-temps=cwd -fdump-rtl-final -fstack-usage $gsplit_dwarf" {alt/ dir/} {{.i .s .???r.final .su .dwo} {.o} {}}
# gcc foo.c bar.c -c -dumpbase main ...
outest "$b doc double -c !-o -db" $mult "-c -dumpbase $b -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{--1.c.???r.final --1.su --1.dwo -1.o --2.c.???r.final --2.su --2.dwo -2.o}}
# gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
outest "$b doc single -c -o -db''" $sing "-c -o dir/$b.o -dumpbase \"\" -fdump-rtl-final -fstack-usage $gsplit_dwarf" {dir/} {{-0.c.???r.final -0.su -0.dwo .o} {}}
# gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
outest "$b doc double !-c -o -db'' -flto" $mult "-o dir/$b.exe -dumpbase \"\" -flto -O2 -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-1.c.???i.icf -2.c.???i.icf .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe} {}}
# gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
outest "$b doc single -c -o -dbx" $sing "-c -o dir/$b-0.o -dumpbase $b.c -dumpbase-ext .c -fdump-rtl-final -fstack-usage $gsplit_dwarf" {dir/} {{.c.???r.final .su .dwo -0.o} {}}
# gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
outest "$b doc double !-c -o -dbx" $mult "-o $b.out -dumpbase-ext .out -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo .out}}
# gcc -dumpdir pfx- -c foo.c ...
outest "$b doc single -c !-o -dd" $sing "-dumpdir $b- -c -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{--0.c.???r.final --0.su --0.dwo -0.o}}
# gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
outest "$b doc single -c -o -dd" $sing "-dumpdir dir/ -c -o obj/$b.o -fdump-rtl-final -fstack-usage $gsplit_dwarf" {dir/ obj/} {{.c.???r.final .su .dwo} {.o} {}}
# gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
outest "$b doc single -c -o -dd -st=" $sing "-dumpdir $b- -c -save-temps=obj -fdump-rtl-final -fstack-usage $gsplit_dwarf" {} {{-0.c.???r.final -0.su -0.dwo -0.i -0.s -0.o}}
# gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
outest "$b doc double -c !-o -dd -db" $mult "-c -dumpdir dir/ -dumpbase $b -fdump-rtl-final -fstack-usage $gsplit_dwarf" {dir/} {{--1.c.???r.final --1.su --1.dwo --2.c.???r.final --2.su --2.dwo} {-1.o -2.o}}
# gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
outest "$b doc single -c !-o -dd -db" $sing "-c -dumpdir dir/ -dumpbase $b -fdump-rtl-final -fstack-usage $gsplit_dwarf" {dir/} {{.???r.final .su .dwo} {-0.o}}
# gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
outest "$b doc double !-c -o -dd" $mult "-dumpdir dir/ -o $b.exe -fdump-rtl-final -fstack-usage $gsplit_dwarf" {dir/} {{-1.c.???r.final -1.su -1.dwo -2.c.???r.final -2.su -2.dwo} {.exe}}
# gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
outest "$b doc single !-c -o -dd -st=" $sing "-c -dumpdir dir/ -dumpbase $b -fdump-rtl-final -fstack-usage $gsplit_dwarf" {dir/} {{.???r.final .su .dwo} {-0.o}}
gcc_parallel_test_enable 1

View File

@ -285,11 +285,53 @@ proc dg-additional-files { args } {
set additional_files [lindex $args 1]
}
set gcc_adjusted_linker_flags 0
# Add -Wl, before any file names in ldflags, libs, and ldscripts, so
# that default object files or libraries do not change the names of
# gcc auxiliary outputs.
proc gcc_adjust_linker_flags {} {
global gcc_adjusted_linker_flags
if {$gcc_adjusted_linker_flags} {
return
}
set gcc_adjusted_linker_flags 1
if {![is_remote host]} {
set dest [target_info name]
foreach i { ldflags libs ldscripts } {
if {[board_info $dest exists $i]} {
set opts [board_info $dest $i]
set nopts {}
set skip ""
foreach opt [split $opts] {
if { $skip != "" } then {
set skip ""
} elseif { $opt == "-Xlinker" } then {
set skip $opt
} elseif { ![string match "-*" $opt] \
&& [file isfile $opt] } {
set opt "-Wl,$opt"
}
lappend nopts $opt
}
if { $nopts != $opts } {
unset_currtarget_info $i
set_currtarget_info $i "$nopts"
}
}
}
}
}
# Return an updated version of OPTIONS that mentions any additional
# source files registered with dg-additional-sources. SOURCE is the
# name of the test case.
proc dg-additional-files-options { options source } {
gcc_adjust_linker_flags
global additional_sources
global additional_sources_used
global additional_files
@ -305,6 +347,10 @@ proc dg-additional-files-options { options source } {
set to_download [concat $to_download $additional_sources]
set additional_sources_used "$additional_sources"
set additional_sources ""
# This option restores naming of aux and dump output files
# after input files when multiple input files are named,
# instead of getting them combined with the output name.
lappend options "additional_flags=-dumpbase \"\""
}
if { $additional_files != "" } then {
regsub -all "^| " $additional_files " [file dirname $source]/" additional_files

View File

@ -353,6 +353,10 @@ proc profopt-execute { src } {
set count 0
foreach option $prof_option_list {
# We pass -dumpbase-ext ${execext}[123] to the compile&link
# commands so as to avoid the combination of the executable
# with the source name in the aux outputs.
set execext ".x${count}"
set execname1 "${executable}${count}1"
set execname2 "${executable}${count}2"
set execname3 "${executable}${count}3"
@ -402,7 +406,7 @@ proc profopt-execute { src } {
# Compile for profiling.
set options "$extra_options"
lappend options "additional_flags=$option $extra_flags $profile_option"
lappend options "additional_flags=$option $extra_flags $profile_option -dumpbase-ext ${execext}1"
set optstr "$option $profile_option"
set comp_output [${tool}_target_compile "$src" "$execname1" executable $options]
if ![${tool}_check_compile "$testcase compilation" $optstr $execname1 $comp_output] {
@ -491,7 +495,7 @@ proc profopt-execute { src } {
# Compile with feedback-directed optimizations.
set options "$extra_options"
lappend options "additional_flags=$option $extra_flags $feedback_option"
lappend options "additional_flags=$option $extra_flags $feedback_option -dumpbase-ext ${execext}2"
set optstr "$option $feedback_option"
if { [string first "-fauto-profile" $options] >= 0} {
set options [regsub -- "-fauto-profile" $options "-fauto-profile=$tmpdir/$bprefix$base.$ext"]
@ -548,7 +552,7 @@ proc profopt-execute { src } {
# Compile with normal optimizations.
set options "$extra_options"
lappend options "additional_flags=$option"
lappend options "additional_flags=$option -dumpbase-ext ${execext}3"
set optstr "$option"
set comp_output [${tool}_target_compile "$src" "$execname3" "executable" $options]
if ![${tool}_check_compile "$testcase compilation" $optstr $execname3 $comp_output] {

View File

@ -32,6 +32,9 @@ proc dump-suffix { arg } {
proc dump-base { args } {
set src [lindex $args 0]
set dumpbase_suf [lindex $args 1]
# The dump basename may vary depending on the output name, on
# whether there are multiple sources. We use -dumpbase "" in
# gcc-defs to base compilation dumps only on the source basename.
set dumpbase $src
if { [string length $dumpbase_suf] != 0 } {
regsub {[.][^.]*$} $src $dumpbase_suf dumpbase

View File

@ -37,11 +37,11 @@ proc scan-ltrans-tree-dump { args } {
}
if { [llength $args] >= 3 } {
scan-dump "ltrans-tree" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".exe.ltrans0" \
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".ltrans0.ltrans" \
[lindex $args 2]
} else {
scan-dump "ltrans-tree" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".exe.ltrans0"
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".ltrans0.ltrans"
}
}
@ -63,10 +63,10 @@ proc scan-ltrans-tree-dump-times { args } {
if { [llength $args] >= 4 } {
scan-dump-times "ltrans-tree" [lindex $args 0] [lindex $args 1] \
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 2]" \
".exe.ltrans0" [lindex $args 3]
".ltrans0.ltrans" [lindex $args 3]
} else {
scan-dump-times "ltrans-tree" [lindex $args 0] [lindex $args 1] \
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 2]" ".exe.ltrans0"
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 2]" ".ltrans0.ltrans"
}
}
@ -87,11 +87,11 @@ proc scan-ltrans-tree-dump-not { args } {
}
if { [llength $args] >= 3 } {
scan-dump-not "ltrans-tree" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".exe.ltrans0" \
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".ltrans0.ltrans" \
[lindex $args 2]
} else {
scan-dump-not "ltrans-tree" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".exe.ltrans0"
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".ltrans0.ltrans"
}
}
@ -113,11 +113,11 @@ proc scan-ltrans-tree-dump-dem { args } {
}
if { [llength $args] >= 3 } {
scan-dump-dem "ltrans-tree" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".exe.ltrans0" \
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".ltrans0.ltrans" \
[lindex $args 2]
} else {
scan-dump-dem "ltrans-tree" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".exe.ltrans0"
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".ltrans0.ltrans"
}
}
@ -139,10 +139,10 @@ proc scan-ltrans-tree-dump-dem-not { args } {
if { [llength $args] >= 3 } {
scan-dump-dem-not "ltrans-tree" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" \
".exe.ltrans0" [lindex $args 2]
".ltrans0.ltrans" [lindex $args 2]
} else {
scan-dump-dem-not "ltrans-tree" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" \
".exe.ltrans0"
".ltrans0.ltrans"
}
}

View File

@ -37,11 +37,11 @@ proc scan-wpa-ipa-dump { args } {
}
if { [llength $args] >= 3 } {
scan-dump "wpa-ipa" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa" \
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa" \
[lindex $args 2]
} else {
scan-dump "wpa-ipa" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa"
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa"
}
}
@ -85,11 +85,11 @@ proc scan-wpa-ipa-dump-times { args } {
}
if { [llength $args] >= 4 } {
scan-dump-times "wpa-ipa" [lindex $args 0] [lindex $args 1] \
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]" ".exe.wpa" \
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]" ".wpa" \
[lindex $args 3]
} else {
scan-dump-times "wpa-ipa" [lindex $args 0] [lindex $args 1] \
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]" ".exe.wpa"
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]" ".wpa"
}
}
@ -110,11 +110,11 @@ proc scan-wpa-ipa-dump-not { args } {
}
if { [llength $args] >= 3 } {
scan-dump-not "wpa-ipa" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa" \
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa" \
[lindex $args 2]
} else {
scan-dump-not "wpa-ipa" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa"
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa"
}
}
@ -136,11 +136,11 @@ proc scan-wpa-ipa-dump-dem { args } {
}
if { [llength $args] >= 3 } {
scan-dump-dem "wpa-ipa" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa" \
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa" \
[lindex $args 2]
} else {
scan-dump-dem "wpa-ipa" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa"
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa"
}
}
@ -161,10 +161,10 @@ proc scan-wpa-ipa-dump-dem-not { args } {
}
if { [llength $args] >= 3 } {
scan-dump-dem-not "wpa-ipa" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa" \
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa" \
[lindex $args 2]
} else {
scan-dump-dem-not "wpa-ipa" [lindex $args 0] \
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa"
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa"
}
}

View File

@ -796,8 +796,8 @@ print_switch_values (print_switch_fn_type print_fn)
case OPT_o:
case OPT_d:
case OPT_dumpbase:
case OPT_dumpbase_ext:
case OPT_dumpdir:
case OPT_auxbase:
case OPT_quiet:
case OPT_version:
/* Ignore these. */
@ -1410,11 +1410,19 @@ process_options (void)
/* Set aux_base_name if not already set. */
if (aux_base_name)
;
else if (main_input_filename)
else if (dump_base_name)
{
char *name = xstrdup (lbasename (main_input_filename));
const char *name = dump_base_name;
int nlen, len;
if (dump_base_ext && (len = strlen (dump_base_ext))
&& (nlen = strlen (name)) && nlen > len
&& strcmp (name + nlen - len, dump_base_ext) == 0)
{
char *p = xstrndup (name, nlen - len);
name = p;
}
strip_off_ending (name, strlen (name));
aux_base_name = name;
}
else
@ -1964,9 +1972,22 @@ static int
lang_dependent_init (const char *name)
{
location_t save_loc = input_location;
if (dump_base_name == 0)
if (!dump_base_name)
{
dump_base_name = name && name[0] ? name : "gccdump";
/* We do not want to derive a non-empty dumpbase-ext from an
explicit -dumpbase argument, only from a defaulted
dumpbase. */
if (!dump_base_ext)
{
const char *base = lbasename (dump_base_name);
const char *ext = strrchr (base, '.');
if (ext)
dump_base_ext = ext;
}
}
/* Other front-end initialization. */
input_location = BUILTINS_LOCATION;
if (lang_hooks.init () == 0)
@ -1977,12 +1998,14 @@ lang_dependent_init (const char *name)
{
init_asm_output (name);
if (!flag_generate_lto && !flag_compare_debug)
{
/* If stack usage information is desired, open the output file. */
if (flag_stack_usage && !flag_generate_lto)
if (flag_stack_usage)
stack_usage_file = open_auxiliary_file ("su");
/* If call graph information is desired, open the output file. */
if (flag_callgraph_info && !flag_generate_lto)
if (flag_callgraph_info)
{
callgraph_info_file = open_auxiliary_file ("ci");
/* Write the file header. */
@ -1992,6 +2015,9 @@ lang_dependent_init (const char *name)
callgraph_info_external_printed = BITMAP_ALLOC (NULL);
}
}
else
flag_stack_usage = flag_callgraph_info = false;
}
/* This creates various _DECL nodes, so needs to be called after the
front end is initialized. */

View File

@ -203,6 +203,10 @@ static bool linker_output_known;
static bool linker_output_auto_nolto_rel;
static const char *link_output_name = NULL;
/* This indicates link_output_name already contains the dot of the
suffix, so we can skip it in extensions. */
static int skip_in_suffix = 0;
/* The version of gold being used, or -1 if not gold. The number is
MAJOR * 100 + MINOR. */
static int gold_version = -1;
@ -621,12 +625,9 @@ exec_lto_wrapper (char *argv[])
/* Write argv to a file to avoid a command line that is too long
Save the file locally on save-temps. */
if (save_temps && link_output_name)
{
arguments_file_name = (char *) xmalloc (strlen (link_output_name)
+ sizeof (".lto_wrapper_args") + 1);
strcpy (arguments_file_name, link_output_name);
strcat (arguments_file_name, ".lto_wrapper_args");
}
arguments_file_name = concat (link_output_name,
".lto_wrapper_args"
+ skip_in_suffix, NULL);
else
arguments_file_name = make_temp_file (".lto_wrapper_args");
check (arguments_file_name, LDPL_FATAL,
@ -1445,6 +1446,76 @@ onload (struct ld_plugin_tv *tv)
if (strstr (collect_gcc_options, "'-v'")
|| strstr (collect_gcc_options, "'--verbose'"))
verbose = true;
const char *p;
if ((p = strstr (collect_gcc_options, "'-dumpdir'")))
{
p += sizeof ("'-dumpdir'");
while (*p == ' ')
p++;
const char *start = p;
int ticks = 0, escapes = 0;
/* Count ticks (') and escaped (\.) characters. Stop at the
end of the options or at a blank after an even number of
ticks (not counting escaped ones. */
for (p = start; *p; p++)
{
if (*p == '\'')
{
ticks++;
continue;
}
else if ((ticks % 2) != 0)
{
if (*p == ' ')
break;
if (*p == '\\')
{
if (*++p)
escapes++;
else
p--;
}
}
}
/* Now allocate a new link_output_name and decode dumpdir
into it. The loop uses the same logic, except it counts
ticks and escapes backwards (so ticks is adjusted if we
find an odd number of them), and it copies characters
that are escaped or not otherwise skipped. */
int len = p - start - ticks - escapes + 1;
char *q = xmalloc (len);
link_output_name = q;
int oddticks = (ticks % 2);
ticks += oddticks;
for (p = start; *p; p++)
{
if (*p == '\'')
{
ticks--;
continue;
}
else if ((ticks % 2) != 0)
{
if (*p == ' ')
break;
if (*p == '\\')
{
if (*++p)
escapes--;
else
p--;
}
}
*q++ = *p;
}
*q = '\0';
assert (escapes == 0);
assert (ticks == oddticks);
assert (q - link_output_name == len - 1);
skip_in_suffix = 1;
}
}
return LDPS_OK;