public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* binutils runtest $CC
@ 2023-04-26  2:35 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-04-26  2:35 UTC (permalink / raw)
  To: binutils

I noticed in the binutile Makefile that runtest is being invoked with
CC, CC_FOR_BUILD and other compiler related flags in the environment.
That doesn't work.  Those variables ought to be passed on the runtest
command line.

After fixing that I had some fails due to binutils testprog.c now
being compiled with the default "-g -O2" picked up in
CFLAGS_FOR_TARGET.  Hack around that by passing -O0.

Also, with the binutils testsuite now taking notice of CC_FOR_TARGET,
I found a couple of debuginfod.exp fails with one of my compilers that
happened to be built without --debug-id being enabled by default.

	* Makefile.am (check-DEJAGNU): Pass $CC and other variable on
	the runtest command line rather than futilely in the
	environment.  Add -O0 to CFLAGS_FOR_TARGET.
	* Makefile.in: Regenerate.
	* testsuite/binutils-all/debuginfod.exp: Compile testprog.c
	with -Wl,--build-id.

diff --git a/binutils/Makefile.am b/binutils/Makefile.am
index 26de6b2955a..8e51310cf55 100644
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -210,10 +210,12 @@ check-DEJAGNU: site.exp
 	EXPECT=$(EXPECT); export EXPECT; \
 	runtest=$(RUNTEST); \
 	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
-	  CC="$(CC)" CC_FOR_BUILD="$(CC_FOR_BUILD)" \
-	  CC_FOR_TARGET="$(CC_FOR_TARGET)" CFLAGS_FOR_TARGET="$(CFLAGS)" \
-		$$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \
-			$(RUNTESTFLAGS); \
+	  $$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \
+		CC="$(CC)" CFLAGS="$(CFLAGS)" \
+		CC_FOR_BUILD="$(CC_FOR_BUILD)" \
+		CC_FOR_TARGET="$(CC_FOR_TARGET)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET) -O0" \
+		$(RUNTESTFLAGS); \
 	else echo "WARNING: could not find \`runtest'" 1>&2; :;\
 	fi
 
diff --git a/binutils/Makefile.in b/binutils/Makefile.in
index 27315addc0f..a58c8aea259 100644
--- a/binutils/Makefile.in
+++ b/binutils/Makefile.in
@@ -1832,10 +1832,12 @@ check-DEJAGNU: site.exp
 	EXPECT=$(EXPECT); export EXPECT; \
 	runtest=$(RUNTEST); \
 	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
-	  CC="$(CC)" CC_FOR_BUILD="$(CC_FOR_BUILD)" \
-	  CC_FOR_TARGET="$(CC_FOR_TARGET)" CFLAGS_FOR_TARGET="$(CFLAGS)" \
-		$$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \
-			$(RUNTESTFLAGS); \
+	  $$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \
+		CC="$(CC)" CFLAGS="$(CFLAGS)" \
+		CC_FOR_BUILD="$(CC_FOR_BUILD)" \
+		CC_FOR_TARGET="$(CC_FOR_TARGET)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET) -O0" \
+		$(RUNTESTFLAGS); \
 	else echo "WARNING: could not find \`runtest'" 1>&2; :;\
 	fi
 
diff --git a/binutils/testsuite/binutils-all/debuginfod.exp b/binutils/testsuite/binutils-all/debuginfod.exp
index 7212d16e85f..f86d8deb2fb 100644
--- a/binutils/testsuite/binutils-all/debuginfod.exp
+++ b/binutils/testsuite/binutils-all/debuginfod.exp
@@ -44,7 +44,7 @@ if { [which $OBJDUMP] == 0} {
 }
 
 # Compile testprog.c, move the debuginfo to a separate file and add .gnu_debuglink.
-if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog executable debug] != ""} {
+if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog executable "debug additional_flags=-Wl,--build-id"] != ""} {
     unsupported "$test (compilation failed)"
     return
 }

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-26  2:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-26  2:35 binutils runtest $CC 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).