public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ld testsuite: Append NOSANITIZE_CFLAGS to CFLAGS_FOR_TARGET
@ 2024-04-09  1:54 Alan Modra
  2024-04-10  5:53 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Modra @ 2024-04-09  1:54 UTC (permalink / raw)
  To: binutils

The idea here is build tests without sanitizer flags, so they don't
fail due to many not using the compiler to link and thus result in
undefined symbols, since libasan is not supplied.  We definitely do not
want a compiler to perform linking in most cases, and it's complicated
to supply libasan (and would possibly disturb testcase output).

	* testsuite/config/default.exp (CFLAGS_FOR_TARGET),
	(CXXFLAGS_FOR_TARGET): Append NOSANITIZE_CFLAGS.
	* testsuite/ld-bootstrap/bootstrap.exp: Use CC_FOR_TARGET and
	CFLAGS_FOR_TARGET throughout.

diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
index afaf4bcb1ff..8374920c775 100644
--- a/ld/testsuite/config/default.exp
+++ b/ld/testsuite/config/default.exp
@@ -481,6 +481,9 @@ if { ![info exists NOSANITIZE_CFLAGS] } then {
     }
 }
 
+append CFLAGS_FOR_TARGET " $NOSANITIZE_CFLAGS"
+append CXXFLAGS_FOR_TARGET " $NOSANITIZE_CFLAGS"
+
 if { ![info exists NOLTO_CFLAGS] } then {
     set NOLTO_CFLAGS ""
     if [compiler_supports "-fno-lto"] {
diff --git a/ld/testsuite/ld-bootstrap/bootstrap.exp b/ld/testsuite/ld-bootstrap/bootstrap.exp
index 437a3bc6842..4b19a1283d3 100644
--- a/ld/testsuite/ld-bootstrap/bootstrap.exp
+++ b/ld/testsuite/ld-bootstrap/bootstrap.exp
@@ -190,7 +190,7 @@ foreach flags $test_flags {
 	setup_xfail "mips*-*-irix5*"
     }
 
-    if ![ld_link $CC tmpdir/ld1 "$CFLAGS $flags tmpdir/ld-partial.o $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
+    if ![ld_link $CC_FOR_TARGET tmpdir/ld1 "$CFLAGS_FOR_TARGET $flags tmpdir/ld-partial.o $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
 	fail $testname
 	continue
     }
@@ -207,13 +207,13 @@ foreach flags $test_flags {
     }
 
     regsub /tmpdir/ld/ $gcc_B_opt_save /tmpdir/gccld1/ gcc_B_opt
-    if ![ld_link $CC tmpdir/ld2 "$CFLAGS $flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
+    if ![ld_link $CC_FOR_TARGET tmpdir/ld2 "$CFLAGS_FOR_TARGET $flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
 	fail $testname
 	continue
     }
 
     regsub /tmpdir/ld/ $gcc_B_opt_save /tmpdir/gccld2/ gcc_B_opt
-    if ![ld_link $CC tmpdir/ld3 "$CFLAGS $flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
+    if ![ld_link $CC_FOR_TARGET tmpdir/ld3 "$CFLAGS_FOR_TARGET $flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
 	fail $testname
 	continue
     }
@@ -226,7 +226,7 @@ foreach flags $test_flags {
 	# generated by different linkers, tmpdir/ld1 and tmpdir/ld2.
 	# So we rebuild tmpdir/ld2 with tmpdir/ld3.
 	regsub /tmpdir/ld/ $gcc_B_opt_save /tmpdir/gccld3/ gcc_B_opt
-	if ![ld_link $CC tmpdir/ld2 "$CFLAGS $flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
+	if ![ld_link $CC_FOR_TARGET tmpdir/ld2 "$CFLAGS_FOR_TARGET $flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
 	    fail $testname
 	    continue
 	}

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: ld testsuite: Append NOSANITIZE_CFLAGS to CFLAGS_FOR_TARGET
  2024-04-09  1:54 ld testsuite: Append NOSANITIZE_CFLAGS to CFLAGS_FOR_TARGET Alan Modra
@ 2024-04-10  5:53 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2024-04-10  5:53 UTC (permalink / raw)
  To: binutils

Don't use CC_FOR_TARGET in the bootstrap test, a silly idea aiming at
consistency that made things worse.  The objects being linked were
built using $CC, so $CC should be used to link.

	* testsuite/ld-bootstrap/bootstrap.exp: Revert last change.

diff --git a/ld/testsuite/ld-bootstrap/bootstrap.exp b/ld/testsuite/ld-bootstrap/bootstrap.exp
index 4b19a1283d3..437a3bc6842 100644
--- a/ld/testsuite/ld-bootstrap/bootstrap.exp
+++ b/ld/testsuite/ld-bootstrap/bootstrap.exp
@@ -190,7 +190,7 @@ foreach flags $test_flags {
 	setup_xfail "mips*-*-irix5*"
     }
 
-    if ![ld_link $CC_FOR_TARGET tmpdir/ld1 "$CFLAGS_FOR_TARGET $flags tmpdir/ld-partial.o $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
+    if ![ld_link $CC tmpdir/ld1 "$CFLAGS $flags tmpdir/ld-partial.o $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
 	fail $testname
 	continue
     }
@@ -207,13 +207,13 @@ foreach flags $test_flags {
     }
 
     regsub /tmpdir/ld/ $gcc_B_opt_save /tmpdir/gccld1/ gcc_B_opt
-    if ![ld_link $CC_FOR_TARGET tmpdir/ld2 "$CFLAGS_FOR_TARGET $flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
+    if ![ld_link $CC tmpdir/ld2 "$CFLAGS $flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
 	fail $testname
 	continue
     }
 
     regsub /tmpdir/ld/ $gcc_B_opt_save /tmpdir/gccld2/ gcc_B_opt
-    if ![ld_link $CC_FOR_TARGET tmpdir/ld3 "$CFLAGS_FOR_TARGET $flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
+    if ![ld_link $CC tmpdir/ld3 "$CFLAGS $flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
 	fail $testname
 	continue
     }
@@ -226,7 +226,7 @@ foreach flags $test_flags {
 	# generated by different linkers, tmpdir/ld1 and tmpdir/ld2.
 	# So we rebuild tmpdir/ld2 with tmpdir/ld3.
 	regsub /tmpdir/ld/ $gcc_B_opt_save /tmpdir/gccld3/ gcc_B_opt
-	if ![ld_link $CC_FOR_TARGET tmpdir/ld2 "$CFLAGS_FOR_TARGET $flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
+	if ![ld_link $CC tmpdir/ld2 "$CFLAGS $flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $SFRAMELIB $extralibs"] {
 	    fail $testname
 	    continue
 	}

-- 
Alan Modra
Australia Development Lab, IBM

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

end of thread, other threads:[~2024-04-10  5:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09  1:54 ld testsuite: Append NOSANITIZE_CFLAGS to CFLAGS_FOR_TARGET Alan Modra
2024-04-10  5:53 ` Alan Modra

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