Re: [PATCH] c-family: Use CAS loop instead of RMW atomics on small _BitInt with padding on targets which need to extend [PR124948]

Jakub Jelinek <[email protected]> Mon, 3 Aug 2026 13:54:43 +0200
Newsgroups gmane.comp.gcc.patches
Message-ID <anCBg-I5DS92mAX9@tucnak>
On Mon, Aug 03, 2026 at 01:50:18PM +0200, Torbjorn SVENSSON wrote:
> This change introduces new failures for arm-none-eabi using thumb/arch=armv6s-m/cpu=cortex-m0/float-abi=soft/fpu=auto.
> 
> Testing torture/bitint-100.c,   -O0
> doing compile
> Executing on host: /build/install-native/bin/arm-none-eabi-gcc  /build/gcc_src/gcc/testsuite/gcc.dg/torture/bitint-100.c  -mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -mfpu=auto   -dumpbase "" -fdiagnostics-plain-output    -O0  -std=c23 -pedantic-errors      --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 -lm -T qemu.ld -o ./bitint-100.exe    (timeout = 800)
> spawn -ignore SIGHUP /build/install-native/bin/arm-none-eabi-gcc /build/gcc_src/gcc/testsuite/gcc.dg/torture/bitint-100.c -mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -mfpu=auto -dumpbase  -fdiagnostics-plain-output -O0 -std=c23 -pedantic-errors --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 -lm -T qemu.ld -o ./bitint-100.exe
> pid is 1478576 -1478576
> /build/install-native/arm-none-eabi/bin/ld: /tmp/ccgSaSgH.o: in function `f1':
> bitint-100.c:(.text+0x5a): undefined reference to `__atomic_compare_exchange_4'
> /build/install-native/arm-none-eabi/bin/ld: (__atomic_compare_exchange_4): Unknown destination type (ARM/Thumb) in /tmp/ccgSaSgH.o
> bitint-100.c:(.text+0x5a): dangerous relocation: unsupported relocation
> /build/install-native/arm-none-eabi/bin/ld: /tmp/ccgSaSgH.o: in function `f2':
> bitint-100.c:(.text+0xa4): undefined reference to `__atomic_compare_exchange_4'
> /build/install-native/arm-none-eabi/bin/ld: (__atomic_compare_exchange_4): Unknown destination type (ARM/Thumb) in /tmp/ccgSaSgH.o
> bitint-100.c:(.text+0xa4): dangerous relocation: unsupported relocation
> ...
> collect2: error: ld returned 1 exit status
>  status 1
> compiler exited with status 1
> FAIL: gcc.dg/torture/bitint-100.c   -O0  (test for excess errors)
> 
> Same failure exist on both trunk and releases/gcc-16.

I thought gcc has been changed to add -latomic_asneeded by default.
Or is this because the linker doesn't support it in this configuration?

	Jakub