]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Force use of -c when precompiling headers
authorChristophe Lyon <christophe.lyon@linaro.org>
Fri, 27 Oct 2023 14:38:02 +0000 (14:38 +0000)
committerChristophe Lyon <christophe.lyon@linaro.org>
Mon, 6 Nov 2023 16:45:06 +0000 (16:45 +0000)
In some configurations of our validation setup, we always call the
compiler with -Wl,-rpath=XXX, which instructs the driver to invoke the
linker if none of -c, -S or -E is used.

This happens to be the case in the PCH tests, where dg-flags-pch sets
dg-do-what-default to precompile.

This works most of the time, in absence of any linker option, the
compiler defaults to generating a precompiled header (otherwise the
linker complains because it cannot find 'main').

This small patch forces the use of '-c' when generating the .gch file,
which is sufficient not to invoke the linker.

Arguably, this could be seen as a dejagnu bug: in gcc-dg-test-1 (in
gcc-dg.exp), we set compile_type to "precompiled_header", which is not
one of the supported values in dejagnu's default_target_compile (in
target.exp).

2023-10-27  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
* lib/dg-pch.exp (dg-flags-pch): Add -c when generating the
precompiled header.

gcc/testsuite/lib/dg-pch.exp

index b6fefaa028669d3e66c682453906377212f6bce6..ae8ce3bf1e1b867de41a94e64b95248fca260782 100644 (file)
@@ -95,7 +95,7 @@ proc dg-flags-pch { subdir test otherflags options suffix } {
        set dg-do-what-default precompile
        catch { file_on_host delete "$bname$suffix" }
        gcc_copy_files "[file rootname $test]${suffix}s" "$bname$suffix"
-       dg-test -keep-output "./$bname$suffix" "$otherflags $flags" ""
+       dg-test -keep-output "./$bname$suffix" "$otherflags $flags -c" ""
 
        # For the rest, the default is to compile to .s.
        set dg-do-what-default compile