On 2026-02-06 11:49, Richard Biener wrote:
> On Thu, 5 Feb 2026, Torbjorn SVENSSON wrote:
> 
>> Hi,
>>
>> Gentle ping for below patch.
> 
> I think I'm now seeing
> 
> +UNRESOLVED: gcc.dg/lto/pr122515 c_lto_pr122515_0.o-c_lto_pr122515.a
> execute  -f
> lto=auto -ffat-lto-objects
> +UNRESOLVED: gcc.dg/lto/pr122515 c_lto_pr122515_0.o-c_lto_pr122515.a link
> -flto
> =auto -ffat-lto-objects
> +FAIL: gcc.dg/lto/pr122515, ar returned 1: /home/rguenther/obj/gcc/gcc-ar:
> Cannot find plugin 'liblto_plugin.so'
> 
> because of this.  This might be a pre-existing issue just exposed, but
> it's still a bug.

Not sure why my tests did not catch this error.
Anyway, I've retested with and without my patch and it's clear that the -B 
argument is missed with my patch.
I've pushed below patch as obvious to fix the issue for both trunk and 
release/gcc-15.

Sorry!

Kind regards,
Torbjörn

> 
> Richard.
> 
>> Kind regards,
>> Torbjörn
>>
>> On 2026-01-29 13:58, Torbjörn SVENSSON wrote:
>>> Changes since v1:
>>>
>>> - Replaced implementation with the same approach as for gcov in
>>>     gcc/testsuite/gcc.misc-tests/gcov.exp to properly support out of
>>>     tree testing.
>>>
>>> Ok for trunk and releases/gcc-15?
>>>
>>> --
>>>
>>> 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, 14 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp
>>> index c307762abc3..0181a3f4e85 100644
>>> --- a/gcc/testsuite/lib/lto.exp
>>> +++ b/gcc/testsuite/lib/lto.exp
>>> @@ -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]
>>
>>
>>
> 


gcc/testsuite/ChangeLog:

        * lib/lto.exp (lto-build-archive): Forward extra command line
        arguments from $GCC_UNDER_TEST to gcc-ar.

Signed-off-by: Torbjörn SVENSSON <[email protected]>
---
 gcc/testsuite/lib/lto.exp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp
index 0181a3f4e85..2a7b8b0de93 100644
--- a/gcc/testsuite/lib/lto.exp
+++ b/gcc/testsuite/lib/lto.exp
@@ -337,6 +337,7 @@ proc lto-build-archive { testname objlist dest } {
        } else {
            set ar_cmd [gcc-transform-out-of-tree gcc-ar]
        }
+       set ar_cmd "$ar_cmd [lrange $GCC_UNDER_TEST 1 end]"
     } else {
         set ar_cmd $GCC_AR_UNDER_TEST
     }
-- 
2.43.0

Reply via email to