On Tue, Aug 04, 2026 at 02:31:51PM +0200, Torbjorn SVENSSON wrote:
> Hello,
>
> The new gcc.dg/lto/pr80922 test appears to fail for all arm-none-eabi targets:
>
> Testing gcc.dg/lto/pr80922-2, -O0 -flto -flto-partition=none
> -fuse-linker-plugin
> doing compile
> Executing on host: /build/r17-2833-g32657f29f91871/bin/arm-none-eabi-gcc
> -mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -mfpu=auto
> -fdiagnostics-plain-output -O0 -flto -flto-partition=none
> -fuse-linker-plugin -O2 -Wfree-nonheap-object -c -o c_lto_pr80922-2_0.o
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-2_0.c (timeout = 800)
> spawn -ignore SIGHUP /build/r17-2833-g32657f29f91871/bin/arm-none-eabi-gcc
> -mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -mfpu=auto
> -fdiagnostics-plain-output -O0 -flto -flto-partition=none -fuse-linker-plugin
> -O2 -Wfree-nonheap-object -c -o c_lto_pr80922-2_0.o
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-2_0.c
> pid is 703324 -703324
> pid is -1
> output is status 0
> PASS: gcc.dg/lto/pr80922-2 c_lto_pr80922-2_0.o assemble, -O0 -flto
> -flto-partition=none -fuse-linker-plugin
> doing compile
> Executing on host: /build/r17-2833-g32657f29f91871/bin/arm-none-eabi-gcc
> -mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -mfpu=auto
> -fdiagnostics-plain-output -O0 -flto -flto-partition=none
> -fuse-linker-plugin -O2 -Wfree-nonheap-object -c -o c_lto_pr80922-2_1.o
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-2_1.c (timeout = 800)
> spawn -ignore SIGHUP /build/r17-2833-g32657f29f91871/bin/arm-none-eabi-gcc
> -mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -mfpu=auto
> -fdiagnostics-plain-output -O0 -flto -flto-partition=none -fuse-linker-plugin
> -O2 -Wfree-nonheap-object -c -o c_lto_pr80922-2_1.o
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-2_1.c
> pid is 703370 -703370
> pid is -1
> output is status 0
> PASS: gcc.dg/lto/pr80922-2 c_lto_pr80922-2_1.o assemble, -O0 -flto
> -flto-partition=none -fuse-linker-plugin
> doing compile
> Executing on host: /build/r17-2833-g32657f29f91871/bin/arm-none-eabi-gcc
> -mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -mfpu=auto
> -fdiagnostics-plain-output -O0 -flto -flto-partition=none
> -fuse-linker-plugin -O2 -Wfree-nonheap-object -c -o c_lto_pr80922-2_2.o
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-2_2.c (timeout = 800)
> spawn -ignore SIGHUP /build/r17-2833-g32657f29f91871/bin/arm-none-eabi-gcc
> -mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -mfpu=auto
> -fdiagnostics-plain-output -O0 -flto -flto-partition=none -fuse-linker-plugin
> -O2 -Wfree-nonheap-object -c -o c_lto_pr80922-2_2.o
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-2_2.c
> pid is 703406 -703406
> pid is -1
> output is status 0
> PASS: gcc.dg/lto/pr80922-2 c_lto_pr80922-2_2.o assemble, -O0 -flto
> -flto-partition=none -fuse-linker-plugin
> doing compile
> Executing on host: /build/r17-2833-g32657f29f91871/bin/arm-none-eabi-gcc
> c_lto_pr80922-2_1.o c_lto_pr80922-2_2.o -mthumb -march=armv6s-m
> -mcpu=cortex-m0 -mfloat-abi=soft -mfpu=auto -dumpbase ""
> -fdiagnostics-plain-output -r --specs=rdimon.specs -Wl,--start-group
> -lc -lm -Wl,--end-group --specs=nosys.specs -Wl,--allow-multiple-definition
> -Wl,-u,_isatty,-u,_fstat -Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main
> -Wl,-wrap,abort -Wl,gcc_tg.o -o c_lto_pr80922-2.o (timeout = 800)
> spawn -ignore SIGHUP /build/r17-2833-g32657f29f91871/bin/arm-none-eabi-gcc
> c_lto_pr80922-2_1.o c_lto_pr80922-2_2.o -mthumb -march=armv6s-m
> -mcpu=cortex-m0 -mfloat-abi=soft -mfpu=auto -dumpbase
> -fdiagnostics-plain-output -r --specs=rdimon.specs -Wl,--start-group -lc -lm
> -Wl,--end-group --specs=nosys.specs -Wl,--allow-multiple-definition
> -Wl,-u,_isatty,-u,_fstat -Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main
> -Wl,-wrap,abort -Wl,gcc_tg.o -o c_lto_pr80922-2.o
> pid is 703440 -703440
> /build/r17-2833-g32657f29f91871/arm-none-eabi/bin/ld: warning: incremental
> linking of LTO and non-LTO objects; using -flinker-output=nolto-rel which
> will bypass whole program optimization
> In function 'myfree2',
> inlined from 'main' at
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-1_1.c:8:3:
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-2_1.c:5:3: warning:
> '__builtin_free' called on unallocated object 'a' [-Wfree-nonheap-object]
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-1_1.c: In function 'main':
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-1_1.c:4:13: note: declared
> here
> In function 'myfree2',
> inlined from 'main' at
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-1_1.c:8:3:
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-2_1.c:10:3: warning:
> '__builtin_free' called on unallocated object 'c' [-Wfree-nonheap-object]
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-1_1.c: In function 'main':
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-1_1.c:4:19: note: declared
> here
> pid is -1
> output is /build/r17-2833-g32657f29f91871/arm-none-eabi/bin/ld: warning:
> incremental linking of LTO and non-LTO objects; using
> -flinker-output=nolto-rel which will bypass whole program optimization
> In function 'myfree2',
> inlined from 'main' at
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-1_1.c:8:3:
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-2_1.c:5:3: warning:
> '__builtin_free' called on unallocated object 'a' [-Wfree-nonheap-object]
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-1_1.c: In function 'main':
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-1_1.c:4:13: note: declared
> here
> In function 'myfree2',
> inlined from 'main' at
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-1_1.c:8:3:
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-2_1.c:10:3: warning:
> '__builtin_free' called on unallocated object 'c' [-Wfree-nonheap-object]
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-1_1.c: In function 'main':
> /build/gcc_src/gcc/testsuite/gcc.dg/lto/pr80922-1_1.c:4:19: note: declared
> here
> status 0
> FAIL: gcc.dg/lto/pr80922-2 c_lto_pr80922-2_2.o-c_lto_pr80922-2_2.o link,
> incr-link
> doing compile
> Executing on host: /build/r17-2833-g32657f29f91871/bin/arm-none-eabi-gcc
> c_lto_pr80922-2_0.o c_lto_pr80922-2.o -mthumb -march=armv6s-m
> -mcpu=cortex-m0 -mfloat-abi=soft -mfpu=auto -dumpbase ""
> -fdiagnostics-plain-output -O0 -flto -flto-partition=none
> -fuse-linker-plugin -O2 -Wfree-nonheap-object --specs=rdimon.specs
> -Wl,--start-group -lc -lm -Wl,--end-group --specs=nosys.specs
> -Wl,--allow-multiple-definition -Wl,-u,_isatty,-u,_fstat -Wl,-wrap,exit
> -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort -Wl,gcc_tg.o -T qemu.ld -o
> gcc-dg-lto-pr80922-2-01.exe (timeout = 800)
> spawn -ignore SIGHUP /build/r17-2833-g32657f29f91871/bin/arm-none-eabi-gcc
> c_lto_pr80922-2_0.o c_lto_pr80922-2.o -mthumb -march=armv6s-m -mcpu=cortex-m0
> -mfloat-abi=soft -mfpu=auto -dumpbase -fdiagnostics-plain-output -O0 -flto
> -flto-partition=none -fuse-linker-plugin -O2 -Wfree-nonheap-object
> --specs=rdimon.specs -Wl,--start-group -lc -lm -Wl,--end-group
> --specs=nosys.specs -Wl,--allow-multiple-definition -Wl,-u,_isatty,-u,_fstat
> -Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort -Wl,gcc_tg.o -T
> qemu.ld -o gcc-dg-lto-pr80922-2-01.exe
> pid is 703533 -703533
> pid is -1
> output is status 0
> FAIL: gcc.dg/lto/pr80922-2 (test for LTO warnings, pr80922-2_0.c line 10 -O0
> -flto -flto-partition=none -fuse-linker-plugin)
> FAIL: gcc.dg/lto/pr80922-2 (test for LTO warnings, pr80922-2_0.c line 15 -O0
> -flto -flto-partition=none -fuse-linker-plugin)
> FAIL: gcc.dg/lto/pr80922-2 (test for LTO warnings, pr80922-2_1.c line 5 -O0
> -flto -flto-partition=none -fuse-linker-plugin)
> FAIL: gcc.dg/lto/pr80922-2 (test for LTO warnings, pr80922-2_1.c line 10 -O0
> -flto -flto-partition=none -fuse-linker-plugin)
> PASS: gcc.dg/lto/pr80922-2 c_lto_pr80922-2_0.o-c_lto_pr80922-2.o link, -O0
> -flto -flto-partition=none -fuse-linker-plugin
>
>
> Kind regards,
> Torbjörn
Thanks, so the test is expecting an LTO-only partial link, and it gets
tripped up because this target adds an extra non-LTO wrapper object to every
link. The attached patch disables the test using
check_effective_target_unwrapped, which I think is the way to go for now? It
works fine on x86-64, fwiw, in that the incr-link test still runs as
before. I don't think I have a way to test on arm-none-eabi myself, unless
there is a cfarm machine I have not found for that...
-Lewis
[PATCH] lto: testsuite: Skip incr-link tests on targets with wrapper object
[PR80922]
The new incr-link LTO test expects to perform an LTO incremental link, but
targets making use of a wrapper object add a non-LTO object to the link, in
which case the test needs to be skipped.
gcc/testsuite/ChangeLog:
PR middle-end/80922
* lib/lto.exp: Skip incremental linking test for wrapped targets.
---
gcc/testsuite/lib/lto.exp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp
index 7243547a52d..db19ff00855 100644
--- a/gcc/testsuite/lib/lto.exp
+++ b/gcc/testsuite/lib/lto.exp
@@ -854,7 +854,9 @@ proc lto-execute-1 { src1 sid } {
# Only attempt the incr-link mode if the linker plugin is explicitly in
use.
set sav_compile_type $compile_type
set sav_obj_list $obj_list
- if { $is_incr_link && [lsearch -exact $option "-fuse-linker-plugin"] <
0 } {
+ if { $is_incr_link
+ && ([lsearch -exact $option "-fuse-linker-plugin"] < 0
+ || ![check_effective_target_unwrapped]) } {
set compile_type "link"
} elseif { $is_incr_link || $is_ar_link } {
set mainsrc [lindex $obj_list 0]