[lld] b26b32b - lld: link libatomic if needed for Timer
Josh Stone via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 21 17:48:07 PDT 2020
Author: Josh Stone
Date: 2020-08-21T17:47:55-07:00
New Revision: b26b32b5d3b85812a12f5e3bf011428612f78e19
URL: https://github.com/llvm/llvm-project/commit/b26b32b5d3b85812a12f5e3bf011428612f78e19
DIFF: https://github.com/llvm/llvm-project/commit/b26b32b5d3b85812a12f5e3bf011428612f78e19.diff
LOG: lld: link libatomic if needed for Timer
D80298 made Timer::total atomic, but this requires linking libatomic
on some targets.
Reviewed By: aaronpuchert
Differential Revision: https://reviews.llvm.org/D85691
Added:
Modified:
lld/CMakeLists.txt
lld/Common/CMakeLists.txt
Removed:
################################################################################
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index e9bd1bd29c5c..7dae682cdef0 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -54,6 +54,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
include(AddLLVM)
include(TableGen)
include(HandleLLVMOptions)
+ include(CheckAtomic)
if(LLVM_INCLUDE_TESTS)
if(CMAKE_VERSION VERSION_LESS 3.12)
diff --git a/lld/Common/CMakeLists.txt b/lld/Common/CMakeLists.txt
index 212328b784c5..bfa4f7b8ee58 100644
--- a/lld/Common/CMakeLists.txt
+++ b/lld/Common/CMakeLists.txt
@@ -1,3 +1,9 @@
+set(LLD_SYSTEM_LIBS ${LLVM_PTHREAD_LIB})
+
+if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
+ list(APPEND LLD_SYSTEM_LIBS atomic)
+endif()
+
find_first_existing_vc_file("${LLVM_MAIN_SRC_DIR}" llvm_vc)
find_first_existing_vc_file("${LLD_SOURCE_DIR}" lld_vc)
@@ -50,7 +56,7 @@ add_lld_library(lldCommon
Target
LINK_LIBS
- ${LLVM_PTHREAD_LIB}
+ ${LLD_SYSTEM_LIBS}
DEPENDS
intrinsics_gen
More information about the llvm-commits
mailing list