RTEMS | GCC 14 Missing Atomic Support Routines for Older Cores (#5267)
Joel Sherrill (@joel)
gitlab at rtems.org
Fri Jun 13 22:09:41 UTC 2025
Joel Sherrill created an issue: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5267
Assignee: Joel Sherrill
## Summary
With GCC 14, it is not explicitly clear that GCC does not have the required atomics helper for older cores without atomic instructions. I first spotted this on the [uC5282](https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5230) but we did not realise this was a pervasive problem with over 30 BSPs across 7 target architectures. The error generated is when linking `spcxx01`:
```
[4381/4381] Linking build/arm/rtl22xx/testsuites/samples/paranoia.exe
/home/joel/rtems-work/tools/next-gcc14/bin/../lib/gcc/arm-rtems7/14.3.0/../../../../arm-rtems7/bin/ld: testsuites/sptests/spcxx01/init.cc.707.o: in function `std::atomic_flag::test_and_set(std::memory_order)':
/home/joel/rtems-work/tools/next-gcc14/lib/gcc/arm-rtems7/14.3.0/include/c++/bits/atomic_base.h:226:(.text.Init+0x1b0): undefined reference to `__atomic_test_and_set'
```
@opticron suggested that it did not matter where this routine was implemented, only that it was available when compiling for that BSP. This undefined function (___atomic_test_and_set_) has a well defined [interface](https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html). Providing this for the impacted BSPs is straightforward. The function is small and it only needs to be added to the YAML files for the BSP variants impacted.
This is the list of BSPs impacted:
- arm - csb336, csb337, csb637, edb7312, gumstix, kit637_v6, lpc24xx_ea, lpc24xx_ncs_ram, lpc24xx_ncs_rom_ext, lpc24xx_ncs_rom_int, lpc24xx_plx800_ram, lpc24xx_plx800_rom_int, lpc32xx_mzx, lpc32xx_mzx_stage_1, lpc32xx_mzx_stage_2, lpc32xx_phycore, rtl22xx, rtl22xx_t, smdk2410
- m68k - av5282, mcf5329
- mips - jmr3904
- moxie - moxiesim
- nios2 - nios2_iss
- riscv - grv32i, grv32im, niosvc10lp, noel32im, rv32i, rv32im,
- sparc - ut699
Some of these are likely candidates for deprecation in 7. But this issue should not be the only factor in that decision. It seems obvious that the RISC-V and SPARC BSPs listed are unlikely candidates for removal.
@opticron and I compiled this list of impacted cores/ISAs found in the above BSPs:
- ARM: arm920, arm920t, arm7tdmi, arm7tdmi-s, xscale, arm926ej-s
- m68k: Coldfire ISA A
- MIPS: arch=3900
- Moxie: only one
- NIOS2: only one
- RISC-V: multiple single core (non-SMP)
- SPARC: ut699
### Pre-set options
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5267
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250613/456f00c7/attachment.htm>
More information about the bugs
mailing list