From db0acd5ace38ea3d5cdb94c275e324b53d70bce0 Mon Sep 17 00:00:00 2001 From: lazymio Date: Thu, 28 Dec 2023 22:50:48 +0800 Subject: [PATCH] Add -latomic to samples and tests --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 055d4f5a..55d9156d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,11 +202,13 @@ else() string(FIND "${UC_COMPILER_MACRO}" "__mips__" UC_RET) if(${UC_RET} GREATER_EQUAL "0") set(UNICORN_TARGET_ARCH "mips") + set(UNICORN_CFLAGS ${UNICORN_CFLAGS} -latomic) break() endif() string(FIND "${UC_COMPILER_MACRO}" "__sparc__" UC_RET) if(${UC_RET} GREATER_EQUAL "0") set(UNICORN_TARGET_ARCH "sparc") + set(UNICORN_CFLAGS ${UNICORN_CFLAGS} -latomic) break() endif() string(FIND "${UC_COMPILER_MACRO}" "__ia64__" UC_RET) @@ -217,6 +219,7 @@ else() string(FIND "${UC_COMPILER_MACRO}" "_ARCH_PPC" UC_RET) if(${UC_RET} GREATER_EQUAL "0") set(UNICORN_TARGET_ARCH "ppc") + set(UNICORN_CFLAGS ${UNICORN_CFLAGS} -latomic) break() endif() string(FIND "${UC_COMPILER_MACRO}" "__riscv" UC_RET) @@ -228,6 +231,7 @@ else() string(FIND "${UC_COMPILER_MACRO}" "__s390__" UC_RET) if(${UC_RET} GREATER_EQUAL "0") set(UNICORN_TARGET_ARCH "s390") + set(UNICORN_CFLAGS ${UNICORN_CFLAGS} -latomic) break() endif() string(FIND ${UC_COMPILER_MACRO} "__tricore__" UC_RET) @@ -1194,6 +1198,7 @@ if(BUILD_SHARED_LIBS) endif() set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} unicorn-common) +set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} ${UNICORN_CFLAGS}) if(UNICORN_HAS_X86) set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -DUNICORN_HAS_X86) set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} x86_64-softmmu)