Ping for this patch

Best regards,
Federico

On 11/6/25 6:40 PM, Federico Terraneo wrote:
As discussed in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122078
GCC defines the __atomic_test_and_set builtin in gcc/sync-builtins.def
On architectures without atomic operations this builtin gets implemented
as a call to a function with the same name.
Libatomic does not provide a symbol named __atomic_test_and_set
resulting in an "undefined reference to `__atomic_test_and_set'"
link-time error.

This bug affects different targets such as m68k-rtems and microblaze who
filed separate bug reports
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118977
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118280

It also affects armv6-m (cortex-m0), as we discovered testing our
target, arm-miosix-eabi which is for the Miosix RTOS for which we
maintain patches outside of the GCC repository.

This patch modifies libatomic to provide the __atomic_test_and_set
symbol as an alias to __atomic_test_and_set_1, a compatible symbol already present in libatomic.

We tested against our target (arm-miosix-eabi). The patch was also tested on rtems for both ARM and m68k:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118977#c9

PS: This is the first patch I propose to GCC, comments welcome.

Best regards,
Federico

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to