binutils runtest $CC
authorAlan Modra <amodra@gmail.com>
Wed, 26 Apr 2023 00:29:40 +0000 (09:59 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 26 Apr 2023 01:02:07 +0000 (10:32 +0930)
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.

binutils/Makefile.am
binutils/Makefile.in
binutils/testsuite/binutils-all/debuginfod.exp

index 26de6b2955acea95678233a381eff69f4549e147..8e51310cf55e1fc9f30dd83c9a2ff2a799616599 100644 (file)
@@ -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
 
index 27315addc0f38cedf7952fa30256f34f3fe778e5..a58c8aea25996da1383d61af2321cefe7bf98a8c 100644 (file)
@@ -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
 
index 7212d16e85fcb31ec0ba0ef46bc810577b64bb0a..f86d8deb2fb8d4e4ce750118a7d950533e29ccb5 100644 (file)
@@ -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
 }