Refine -latomic fix
This commit is contained in:
@@ -89,6 +89,9 @@ include_directories(
|
||||
qemu/tcg
|
||||
)
|
||||
|
||||
# Some distributions on some rare architecures don't auto link atomic for us and
|
||||
# we do this manually by adding flags.
|
||||
set(ATOMIC_LINKAGE_FIX FALSE)
|
||||
if(MSVC)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(MSVC_FLAG -D__x86_64__)
|
||||
@@ -191,7 +194,7 @@ else()
|
||||
string(FIND "${UC_COMPILER_MACRO}" "__arm__" UC_RET)
|
||||
if(${UC_RET} GREATER_EQUAL "0")
|
||||
set(UNICORN_TARGET_ARCH "arm")
|
||||
set(UNICORN_CFLAGS ${UNICORN_CFLAGS} -latomic)
|
||||
set(ATOMIC_LINKAGE_FIX TRUE)
|
||||
break()
|
||||
endif()
|
||||
string(FIND "${UC_COMPILER_MACRO}" "__aarch64__" UC_RET)
|
||||
@@ -202,13 +205,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)
|
||||
set(ATOMIC_LINKAGE_FIX TRUE)
|
||||
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)
|
||||
set(ATOMIC_LINKAGE_FIX TRUE)
|
||||
break()
|
||||
endif()
|
||||
string(FIND "${UC_COMPILER_MACRO}" "__ia64__" UC_RET)
|
||||
@@ -219,19 +222,19 @@ 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)
|
||||
set(ATOMIC_LINKAGE_FIX TRUE)
|
||||
break()
|
||||
endif()
|
||||
string(FIND "${UC_COMPILER_MACRO}" "__riscv" UC_RET)
|
||||
if(${UC_RET} GREATER_EQUAL "0")
|
||||
set(UNICORN_TARGET_ARCH "riscv")
|
||||
set(UNICORN_CFLAGS ${UNICORN_CFLAGS} -latomic)
|
||||
set(ATOMIC_LINKAGE_FIX TRUE)
|
||||
break()
|
||||
endif()
|
||||
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)
|
||||
set(ATOMIC_LINKAGE_FIX TRUE)
|
||||
break()
|
||||
endif()
|
||||
string(FIND ${UC_COMPILER_MACRO} "__tricore__" UC_RET)
|
||||
@@ -424,6 +427,11 @@ else()
|
||||
-Wall
|
||||
-fPIC
|
||||
)
|
||||
if (ATOMIC_LINKAGE_FIX)
|
||||
add_compile_options(
|
||||
-latomic
|
||||
)
|
||||
endif()
|
||||
if(APPLE)
|
||||
# This warning is disabled by default for gcc and doesn't cause any bug.
|
||||
add_compile_options(
|
||||
@@ -1198,7 +1206,9 @@ if(BUILD_SHARED_LIBS)
|
||||
endif()
|
||||
|
||||
set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} unicorn-common)
|
||||
set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} ${UNICORN_CFLAGS})
|
||||
if (ATOMIC_LINKAGE_FIX)
|
||||
set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -latomic)
|
||||
endif()
|
||||
if(UNICORN_HAS_X86)
|
||||
set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -DUNICORN_HAS_X86)
|
||||
set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} x86_64-softmmu)
|
||||
|
||||
Reference in New Issue
Block a user