Test that gcc -B picks up new ld
authorAlan Modra <amodra@gmail.com>
Sat, 21 Apr 2018 02:36:57 +0000 (12:06 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 21 Apr 2018 09:18:40 +0000 (18:48 +0930)
gcc configured using --with-ld always uses that particular version of
ld if it exists.  This patch adds a check that the ld version reported
directly from ld-new matches that reported via gcc.  I chose to
compare the ld --version output rather than a more strict test (for
example by gcc --print-prog-name=ld), because the version test allows
a user to run the ld testsuite after installing a new ld (in the place
expected by gcc).

Sample output:

Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using /home/alan/src/binutils-gdb/ld/testsuite/config/default.exp as tool-and-target-specific interface file.
ERROR: ************************************************************************
ERROR: Your compiler driver ignores -B when choosing ld.
ERROR: You will not be testing the new ld in many of the following tests.
ERROR: It seems you will be testing /usr/bin/x86_64-w64-mingw32-ld instead.
ERROR: ************************************************************************
WARNING: Assuming target board is the local machine (which is probably wrong).
You may need to set your DEJAGNU environment variable.
Running /home/alan/src/binutils-gdb/ld/testsuite/ld-aarch64/aarch64-elf.exp ...

* testsuite/lib/ld-lib.exp (run_host_cmd): Check that gcc -B
works.

ld/ChangeLog
ld/testsuite/lib/ld-lib.exp

index a101489d1844e6734c32e3a099f9ddc56a0cf56b..366e59e23fed6826ecca59ac5dfcdc54eb1a2043 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-21  Alan Modra  <amodra@gmail.com>
+
+       * testsuite/lib/ld-lib.exp (run_host_cmd): Check that gcc -B
+       works.
+
 2018-04-18  Alan Modra  <amodra@gmail.com>
 
        * Makefile.am: Remove support for assorted i386 aout and coff targets.
index cce87bfcf8081ac803f12dbbe417fb309e1f3eee..9a0f350f53b4707b2b59243b1b8a3dfb046ff9b0 100644 (file)
@@ -85,6 +85,8 @@ proc run_host_cmd { prog command } {
     global link_output
     global gcc_B_opt
     global ld_L_opt
+    global gcc_ld_B_opt_tested
+    global ld
 
     if { ![is_remote host] && [which "$prog"] == 0 } then {
        perror "$prog does not exist"
@@ -106,6 +108,22 @@ proc run_host_cmd { prog command } {
     set gccexe [string replace $gccexe 0 [string last "/" $gccexe] ""]
     if {[string match "*cc*" $gccexe] || [string match "*++*" $gccexe]} then {
        set gccflags "$gcc_B_opt $gccflags $ld_L_opt"
+       if {![info exists gcc_ld_B_opt_tested]} {
+           set gcc_ld_B_opt_tested 1
+           set ld_version_message [run_host_cmd "$ld" "--version"]
+           set gcc_ld_version_message [run_host_cmd "$prog" "$gccflags -Wl,--version"]
+           if {[string first $ld_version_message $gcc_ld_version_message] < 0} {
+               perror "************************************************************************"
+               perror "Your compiler driver ignores -B when choosing ld."
+               perror "You will not be testing the new ld in many of the following tests."
+               set gcc_ld_version [run_host_cmd "$prog" "$gccflags --print-prog-name=ld"]
+               if {![string match "" $gcc_ld_version] && ![string match "ld" $gcc_ld_version]} {
+               
+                   perror "It seems you will be testing $gcc_ld_version instead."
+               }
+               perror "************************************************************************"
+           }
+       }
     }
 
     verbose -log "$prog $gccflags $command"
This page took 0.02762 seconds and 4 git commands to generate.