Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libmetal/atomic: enable 64-bit atomic by toolchain builtin flags #301

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anchao
Copy link
Contributor

@anchao anchao commented Jun 29, 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 anchao@lixiang.com

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 <anchao@lixiang.com>
Copy link

This pull request has been marked as a stale pull request because it has been open (more than) 45 days with no activity.

@github-actions github-actions bot added the Stale label Aug 20, 2024
@wmamills
Copy link
Contributor

wmamills commented Sep 5, 2024

@ancho please tell us more about your compiler RTOS platform etc. We don't see this issue on other gcc based 32 bit platforms

@github-actions github-actions bot removed the Stale label Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants