public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: Force use of -c when precompiling headers
@ 2023-10-27 15:11 Christophe Lyon
  2023-11-05 20:24 ` Mike Stump
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe Lyon @ 2023-10-27 15:11 UTC (permalink / raw)
  To: gcc-patches, ro, mikestump; +Cc: Christophe Lyon

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/lib/dg-pch.exp b/gcc/testsuite/lib/dg-pch.exp
index b6fefaa0286..ae8ce3bf1e1 100644
--- a/gcc/testsuite/lib/dg-pch.exp
+++ b/gcc/testsuite/lib/dg-pch.exp
@@ -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
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] testsuite: Force use of -c when precompiling headers
  2023-10-27 15:11 [PATCH] testsuite: Force use of -c when precompiling headers Christophe Lyon
@ 2023-11-05 20:24 ` Mike Stump
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Stump @ 2023-11-05 20:24 UTC (permalink / raw)
  To: Christophe Lyon; +Cc: gcc-patches, ro@cebitec.uni-bielefeld.de

On Oct 27, 2023, at 8:11 AM, Christophe Lyon <christophe.lyon@linaro.org> wrote:
> 
> 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.

Ok.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-05 20:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-27 15:11 [PATCH] testsuite: Force use of -c when precompiling headers Christophe Lyon
2023-11-05 20:24 ` Mike Stump

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).