On 2026-01-28 15:58, Richard Biener wrote:
On Wed, 28 Jan 2026, Torbjörn SVENSSON wrote:

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 <[email protected]>
---
  gcc/testsuite/lib/lto.exp | 17 ++++++++++++-----
  1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp
index c307762abc3..696f498d545 100644
--- a/gcc/testsuite/lib/lto.exp
+++ b/gcc/testsuite/lib/lto.exp
@@ -312,7 +312,7 @@ proc lto-obj { source dest optall optfile optstr xfaildata 
} {
  proc lto-build-archive { testname objlist dest } {
      global testcase
      global tool
-    global GCC_UNDER_TEST
+    global gcc_ar
upvar dg-messages-by-file dg-messages-by-file @@ -327,10 +327,17 @@ 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]"
-    set ar_output [remote_exec host "$ar_cmd rcs $dest $objlist"]
+    # Find gcc-ar like we find g++ in g++.exp.
+    if ![info exists gcc_ar]  {
+       set gcc_ar [findfile $base_dir/../../../binutils/gcc-ar \
+               $base_dir/../../../binutils/gcc-ar \
+               [findfile $base_dir/../../gcc-ar $base_dir/../../gcc-ar \
+               [findfile $base_dir/gcc-ar $base_dir/gcc-ar \
+               [transform gcc-ar]]]]
+       verbose -log "gcc-ar is $gcc_ar"

Doesn't this break installed testing based on GCC_UNDER_TEST?

There are a bunch of other places in gcc/testsuites/lib/ where a similar block 
to the one above is still used.
I've not changed any of those, but found another block used for gcov that I 
adapted to gcc-ar instead. Please take a look at the v2 of this patch.

Kind regards,
Torbjörn



+    }
+
+    set ar_output [remote_exec host "$gcc_ar rcs $dest $objlist"]
      set retval [lindex $ar_output 0]
      set retmsg [lindex $ar_output 1]


Reply via email to