From 76e83a54243d21ca91d8c0722cf8f26c57c67cb9 Mon Sep 17 00:00:00 2001 From: chenrun1 Date: Sat, 14 Sep 2024 16:46:07 +0800 Subject: [PATCH] arch_atomic.c:Provide __sync_synchronize when the compiler does not support it Summary: Configuration/Tool: zp214xpa/nsh,CONFIG_ARM_TOOLCHAIN_GNU_EABI 2024-09-14 06:11:00 ------------------------------------------------------------------------------------ Cleaning... Configuring... Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI Building NuttX... arm-none-eabi-ld: /github/workspace/sources/nuttx/staging/libfs.a(fs_inoderemove.o): in function `inode_remove': fs_inoderemove.c:(.text.inode_remove+0x94): undefined reference to `__sync_synchronize' arm-none-eabi-ld: fs_inoderemove.c:(.text.inode_remove+0x9c): undefined reference to `__sync_synchronize' make[1]: *** [Makefile:212: nuttx] Error 1 make: *** [tools/Unix.mk:548: nuttx] Error 2 make: Target 'all' not remade because of errors. Signed-off-by: chenrun1 --- libs/libc/machine/arch_atomic.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libs/libc/machine/arch_atomic.c b/libs/libc/machine/arch_atomic.c index 0db93e79b2..fef258e718 100644 --- a/libs/libc/machine/arch_atomic.c +++ b/libs/libc/machine/arch_atomic.c @@ -753,17 +753,15 @@ SYNC_VAL_CMP_SWAP(4, uint32_t) SYNC_VAL_CMP_SWAP(8, uint64_t) -#endif /* __clang__ */ - -#ifdef __ghs__ - /**************************************************************************** * Name: __sync_synchronize ****************************************************************************/ void weak_function __sync_synchronize(void) { - asm volatile("" ::: "memory"); +#ifdef SP_DMB + SP_DMB(); +#endif } -#endif +#endif /* __clang__ */