From 9a8aea1b682f522d7b278312b9bd85ed12fab820 Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Tue, 11 Aug 2020 10:13:37 -0700 Subject: [PATCH] CMake: Link with -latomic Some architecutres (such as RISC-V) require that atomics be specifically linked to avoid build failures. Ensure that this is the case. Signed-off-by: Alistair Francis Change-Id: Iad543232a6547b197f04100e996e6200c9f803ce --- CMakeLists.txt | 1 + src/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 62c56a9c..0a2713ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,6 +155,7 @@ SET(link_libraries ${LIBMAGIC_LDFLAGS} -ldl -lrt + -latomic ) ADD_SUBDIRECTORY(src/devtools) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3e3a9e15..ab776626 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -172,6 +172,7 @@ TARGET_LINK_LIBRARIES(afbwsc ${libsystemd_LDFLAGS} ${json-c_LDFLAGS} -lpthread + -latomic -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-afbwsc.map -Wl,--as-needed -Wl,--gc-sections -- 2.16.6