Hello,

for the RISC-V target, I would like to use the -march=rv64imc ISA variant. 
However, there is an issue with the libatomic for this target in the RTEMS 
configuration. For this test code:

#include <stdatomic.h>

bool tas(atomic_flag *f)
{
        return atomic_flag_test_and_set(f);
}

GCC 15 generates:

riscv-rtems6-gcc -O2 -S -o - -march=rv64imc -mabi=lp64 test.c
        .file   "test.c"
        .option nopic
        .attribute arch, "rv64i2p1_m2p0_c2p0_zmmul1p0_zca1p0"
        .attribute unaligned_access, 0
        .attribute stack_align, 16
        .text
        .align  1
        .globl  tas
        .type   tas, @function
tas:
        li      a1,5
        tail    __atomic_test_and_set
        .size   tas, .-tas
        .ident  "GCC: 15.1.1 20250517"
        .section        .note.GNU-stack,"",@progbits

In the corresponding libatomic.a multilib, there are the following functions 
(omitting *_4, *_8, *_16 variants which exist for all *_1 variants):

__atomic_add_fetch_1
__atomic_and_fetch_1
__atomic_compare_exchange
__atomic_compare_exchange_1
__atomic_exchange
__atomic_exchange_1
__atomic_feraiseexcept
__atomic_fetch_add_1
__atomic_fetch_and_1
__atomic_fetch_nand_1
__atomic_fetch_or_1
__atomic_fetch_sub_1
__atomic_fetch_xor_1
__atomic_is_lock_free
__atomic_load
__atomic_load_1
__atomic_nand_fetch_1
__atomic_or_fetch_1
__atomic_store
__atomic_store_1
__atomic_sub_fetch_1
__atomic_test_and_set_1
__atomic_xor_fetch_1

Some operations have a variant without a _1, _2, _4, _8, and _16 postfix 
(example: __atomic_store). Others do not have such a variant, examples: 
__atomic_test_and_set_1, __atomic_add_fetch_1.

I am a bit clueless what is going on here. Are the missing variants a libatomic 
configuration error? Is it a general configuration error or specific to RTEMS?

-- 
embedded brains GmbH & Co. KG
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

Reply via email to