On 2026-05-15 13:00, Jakub Jelinek wrote:
On Fri, May 15, 2026 at 11:50:57AM +0100, Richard Earnshaw (foss) wrote:
On 11/05/2026 08:51, Torbjörn SVENSSON wrote:
Ok for trunk and releases/gcc-16?

--

The fix applied to toplevel-extended-asm-1_0.c in r16-7892-gb02f9495dcf635,
also needs to be applied to toplevel-simple-asm-1_0.c.

gcc/testsuite/ChangeLog:

        * gcc.dg/lto/toplevel-simple-asm-1_0.c: Adjust inline assembler
        for arm-none-eabi.

LGTM, but please give Jakub until Monday to comment.

This change is wrong.  The point of toplevel-simple-asm*
tests is to test the simple toplevel asms, the point of
toplevel-extended-asm* is to test extended asms.
So, by turning the simple test into extended one, it duplicates the
toplevel-extended-asm-1_0.c test, making it useless.

I see. To be honest, I did not understand the difference between the two tests, 
but now I get it. Thanks for the clarification.

If arm-none-gnueabi can't handle .global without .type directive
(why?), then you should adjust your changes so that it still
uses simple asm, so something like

The target is arm-none-eabi, not arm-none-gnueai if it matters.
I don't know why it would not work without .type. I'm far out in the woods on 
this one. :)

This is the error in the log that I'm trying to address:

lto-execute: /build/gcc_src/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-1_0.c
getting options for 
/build/gcc_src/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-1_0.c:  { dg-lto-do 
1 link } { dg-lto-options 2 { {-O2 -flto -flto-toplevel-asm-heuristics 
-flto-partition=1to1} {-O2 -flto -flto-toplevel-asm-heuristics 
-flto-partition=max} {-O2 -flto -flto-toplevel-asm-heuristics 
-flto-partition=cache}} }
cmd is dg-lto-do
dg-lto-do command for " dg-lto-do 1 link " is link
cmd is dg-lto-options
dg-extra-tool-flags for main is  {-O2 -flto -flto-toplevel-asm-heuristics 
-flto-partition=1to1} {-O2 -flto -flto-toplevel-asm-heuristics 
-flto-partition=max} {-O2 -flto -flto-toplevel-asm-heuristics 
-flto-partition=cache}
        src_list is: 
/build/gcc_src/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-1_0.c 
/build/gcc_src/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-1_1.c
Testing gcc.dg/lto/toplevel-simple-asm-1, -O2 -flto 
-flto-toplevel-asm-heuristics -flto-partition=1to1
doing compile
Executing on host: /build/r16-8473-g5cc0ead3625fe6/bin/arm-none-eabi-gcc   
-mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft   
-fdiagnostics-plain-output  -O2 -flto -flto-toplevel-asm-heuristics 
-flto-partition=1to1  -c     -o c_lto_toplevel-simple-asm-1_0.o 
/build/gcc_src/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-1_0.c    (timeout = 
800)
spawn -ignore SIGHUP /build/r16-8473-g5cc0ead3625fe6/bin/arm-none-eabi-gcc 
-mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft 
-fdiagnostics-plain-output -O2 -flto -flto-toplevel-asm-heuristics 
-flto-partition=1to1 -c -o c_lto_toplevel-simple-asm-1_0.o 
/build/gcc_src/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-1_0.c
pid is 19869 -19869
pid is -1
output is  status 0
PASS: gcc.dg/lto/toplevel-simple-asm-1 c_lto_toplevel-simple-asm-1_0.o 
assemble, -O2 -flto -flto-toplevel-asm-heuristics -flto-partition=1to1
doing compile
Executing on host: /build/r16-8473-g5cc0ead3625fe6/bin/arm-none-eabi-gcc   
-mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft   
-fdiagnostics-plain-output  -O2 -flto -flto-toplevel-asm-heuristics 
-flto-partition=1to1  -c     -o c_lto_toplevel-simple-asm-1_1.o 
/build/gcc_src/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-1_1.c    (timeout = 
800)
spawn -ignore SIGHUP /build/r16-8473-g5cc0ead3625fe6/bin/arm-none-eabi-gcc 
-mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft 
-fdiagnostics-plain-output -O2 -flto -flto-toplevel-asm-heuristics 
-flto-partition=1to1 -c -o c_lto_toplevel-simple-asm-1_1.o 
/build/gcc_src/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-1_1.c
pid is 19926 -19926
pid is -1
output is  status 0
PASS: gcc.dg/lto/toplevel-simple-asm-1 c_lto_toplevel-simple-asm-1_1.o 
assemble, -O2 -flto -flto-toplevel-asm-heuristics -flto-partition=1to1
doing compile
Executing on host: /build/r16-8473-g5cc0ead3625fe6/bin/arm-none-eabi-gcc  
c_lto_toplevel-simple-asm-1_0.o c_lto_toplevel-simple-asm-1_1.o  -mthumb -march=armv6s-m 
-mcpu=cortex-m0 -mfloat-abi=soft   -dumpbase "" -fdiagnostics-plain-output  -O2 
-flto -flto-toplevel-asm-heuristics -flto-partition=1to1       --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 gcc-dg-lto-toplevel-simple-asm-1-01.exe  
  (timeout = 800)
spawn -ignore SIGHUP /build/r16-8473-g5cc0ead3625fe6/bin/arm-none-eabi-gcc 
c_lto_toplevel-simple-asm-1_0.o c_lto_toplevel-simple-asm-1_1.o -mthumb 
-march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -dumpbase  
-fdiagnostics-plain-output -O2 -flto -flto-toplevel-asm-heuristics 
-flto-partition=1to1 --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 gcc-dg-lto-toplevel-simple-asm-1-01.exe
pid is 19978 -19978
lto-wrapper: warning: using serial compilation of 2 LTRANS jobs
lto-wrapper: note: see the '-flto' option documentation for more information
/build/r16-8473-g5cc0ead3625fe6/arm-none-eabi/bin/ld: 
/tmp/cci7XScc.ltrans0.ltrans.o(asm_fn_used): Unknown destination type 
(ARM/Thumb) in /tmp/cci7XScc.ltrans1.ltrans.o
/tmp/cci7XScc.ltrans1.ltrans.o: in function `local_caller':
<artificial>:(.text+0x12): dangerous relocation: unsupported relocation
collect2: error: ld returned 1 exit status
pid is -1
close result is 19978 exp6 0 1
output is lto-wrapper: warning: using serial compilation of 2 LTRANS jobs
lto-wrapper: note: see the '-flto' option documentation for more information
/build/r16-8473-g5cc0ead3625fe6/arm-none-eabi/bin/ld: 
/tmp/cci7XScc.ltrans0.ltrans.o(asm_fn_used): Unknown destination type 
(ARM/Thumb) in /tmp/cci7XScc.ltrans1.ltrans.o
/tmp/cci7XScc.ltrans1.ltrans.o: in function `local_caller':
<artificial>:(.text+0x12): dangerous relocation: unsupported relocation
collect2: error: ld returned 1 exit status
 status 1
compiler exited with status 1
FAIL: gcc.dg/lto/toplevel-simple-asm-1 
c_lto_toplevel-simple-asm-1_0.o-c_lto_toplevel-simple-asm-1_1.o link, -O2 -flto 
-flto-toplevel-asm-heuristics -flto-partition=1to1


#ifdef __ELF__
#ifdef __sparc__
#define TYPE_PFX "#"
#elif defined (__arm__) || defined (__aarch64__)
#define TYPE_PFX "%"
#else
#define TYPE_PFX "@"
#endif
#endif

#ifdef TYPE_PFX
asm(".global asm_fn\n.type asm_fn, " TYPE_PFX "function\nasm_fn:");
asm(".global asm_fn_used\n.type asm_fn_used, " TYPE_PFX 
"function\nasm_fn_used:");
#else
asm(".global asm_fn\nasm_fn:");
asm(".global asm_fn_used\nasm_fn_used:");
#endif

This does resolve the failure.
Okay to push with this instead or do you want a v2 with it first?

Kind regards,
Torbjörn

Reply via email to