Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fd0deb2

Browse files
committedOct 17, 2024·
libmetal/atomic: enable 64-bit atomic by toolchain builtin flags
Fix compile error: arm-none-eabi-ld: (remoteproc_virtio.o): in function `metal_io_read': metal/io.h:252: undefined reference to `__atomic_load_8' arm-none-eabi-ld: (remoteproc_virtio.o): in function `metal_io_write': metal/io.h:290: undefined reference to `__atomic_store_8' Not all 32-bit architectures support 64bit atomic, gcc/clang toolchains have built-in properties to indicate whether support atomic64: | $ arm-none-eabi-gcc -march=armv7e-m -dM -E - < /dev/null | grep SYNC | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 Signed-off-by: chao an <[email protected]>
1 parent 969420f commit fd0deb2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎lib/io.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ extern "C" {
3030
* @{
3131
*/
3232

33-
#ifdef __MICROBLAZE__
33+
#if defined(__MICROBLAZE__) || \
34+
(defined(__GNUC__) && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8))
3435
#define NO_ATOMIC_64_SUPPORT
3536
#endif
3637

0 commit comments

Comments
 (0)
Please sign in to comment.