PR23235, make check uses system installed ld
authorAlan Modra <amodra@gmail.com>
Mon, 28 May 2018 07:00:23 +0000 (16:30 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 28 May 2018 12:13:44 +0000 (21:43 +0930)
This patch doesn't stop the build-id and debuglink tests using the
installed ld, it just prevents a compiler failure from resulting in a
test fail.  We could move the tests to the ld testsuite but it doesn't
seem all that important.

PR 23235
* testsuite/binutils-all/compress.exp (test_gnu_debuglink): Return
unsupported rather than fail on compile errors.
* testsuite/binutils-all/objdump.exp (test_build_id_debuglink):
Likewise.  Save and restore CFLAGS_FOR_TARGET.

binutils/ChangeLog
binutils/testsuite/binutils-all/compress.exp
binutils/testsuite/binutils-all/objdump.exp

index 2943b1d31b4d343ffe5a0d5e79ffd93f08d8b9c0..185dffdc3c562ed257e2cc84fd4ae5b64ca65e46 100644 (file)
@@ -1,3 +1,11 @@
+2018-05-28  Alan Modra  <amodra@gmail.com>
+
+       PR 23235
+       * testsuite/binutils-all/compress.exp (test_gnu_debuglink): Return
+       unsupported rather than fail on compile errors.
+       * testsuite/binutils-all/objdump.exp (test_build_id_debuglink):
+       Likewise.  Save and restore CFLAGS_FOR_TARGET.
+
 2018-05-18  Kito Cheng  <kito.cheng@gmail.com>
 
        * readelf.c (get_machine_flags): Handle EF_RISCV_RVE.
index 12a43b025c5339b46d78cf1bedb241c376315a5f..edbe9dd5ca699580a3c4022c93f070f075571de8 100644 (file)
@@ -692,7 +692,7 @@ proc test_gnu_debuglink {} {
     }
 
     if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog exectuable debug] != "" } {
-       fail "$test (build)"
+       unsupported "$test (build)"
        return
     }
     set got [remote_exec host "$OBJDUMP -S tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.dump"]
index b9232e9229490ced9160a6b3ce710e12c2aa85e3..d9d07138aa041b9e0de87874d2941d46f6e0c20d 100644 (file)
@@ -363,14 +363,21 @@ proc test_build_id_debuglink {} {
     }
 
     # Use a fixed build-id.
+    if { [info exists CFLAGS_FOR_TARGET] } {
+       set save_CFLAGS_FOR_TARGET $CFLAGS_FOR_TARGET
+    }
     set CFLAGS_FOR_TARGET "-g -Wl,--build-id=0x12345678abcdef01"
 
     if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog exectuable debug] != "" } {
-       fail "$test (build)"
+       unsupported "$test (build)"
        return
     }
 
-    # FIXME: Do we need to restore CFLAGS_FOR_TARGET to its old value ?
+    if { [info exists save_CFLAGS_FOR_TARGET] } {
+       set CFLAGS_FOR_TARGET $save_CFLAGS_FOR_TARGET
+    } else {
+       unset CFLAGS_FOR_TARGET
+    }
 
     if { [binutils_run $STRIP "--strip-debug --remove-section=.comment tmpdir/testprog -o tmpdir/testprog.strip"] != "" } {
        fail "$test (strip debug info)"