]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: lto: transform gcc-ar to include prefix
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Wed, 28 Jan 2026 13:43:07 +0000 (14:43 +0100)
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Thu, 5 Feb 2026 13:42:46 +0000 (14:42 +0100)
When the the gcc binary is named arm-none-eabi-gcc, the gcc-ar binary
will be named arm-none-eabi-gcc-ar.  The current approach works fine as
long as the binary does not contain any prefix, but if it does, the
gcc-ar binary will not be found.

gcc/testsuite/ChangeLog

* lib/lto.exp (lto-build-archive): Transform gcc-ar binary name.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
gcc/testsuite/lib/lto.exp

index c307762abc3c3349608dbf8931a39806dad97319..0181a3f4e85d2044fa6c67de56361ce6865a60a8 100644 (file)
@@ -313,6 +313,7 @@ proc lto-build-archive { testname objlist dest } {
     global testcase
     global tool
     global GCC_UNDER_TEST
+    global GCC_AR_UNDER_TEST
 
     upvar dg-messages-by-file dg-messages-by-file
 
@@ -327,9 +328,19 @@ proc lto-build-archive { testname objlist dest } {
        }
     }
 
-    # Hack up the gcc-ar command from $GCC_UNDER_TEST.
-    set ar_cmd [file dirname [lindex $GCC_UNDER_TEST 0]]
-    set ar_cmd "$ar_cmd/gcc-ar [lrange $GCC_UNDER_TEST 1 end]"
+    # For now find gcc-ar in the same directory as $GCC_UNDER_TEST, unless
+    # GCC_AR_UNDER_TEST is defined.
+
+    if ![info exists GCC_AR_UNDER_TEST] {
+       if { ![is_remote host] && [string match "*/*" [lindex $GCC_UNDER_TEST 0]] } {
+           set ar_cmd [file dirname [lindex $GCC_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcc-ar]
+       } else {
+           set ar_cmd [gcc-transform-out-of-tree gcc-ar]
+       }
+    } else {
+        set ar_cmd $GCC_AR_UNDER_TEST
+    }
+
     set ar_output [remote_exec host "$ar_cmd rcs $dest $objlist"]
     set retval [lindex $ar_output 0]
     set retmsg [lindex $ar_output 1]