[llvm-branch-commits] [lld] 1708358 - lld: link libatomic if needed for Timer
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Aug 24 10:46:24 PDT 2020
Author: Josh Stone
Date: 2020-08-24T19:46:04+02:00
New Revision: 1708358fbbf58d4a870be015ef21eeea9adae87b
URL: https://github.com/llvm/llvm-project/commit/1708358fbbf58d4a870be015ef21eeea9adae87b
DIFF: https://github.com/llvm/llvm-project/commit/1708358fbbf58d4a870be015ef21eeea9adae87b.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
(cherry picked from commit b26b32b5d3b85812a12f5e3bf011428612f78e19)
Added:
Modified:
lld/CMakeLists.txt
lld/Common/CMakeLists.txt
Removed:
################################################################################
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index 5090c935e75a..040bb2c8f6d7 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 53649032bd98..41eb58c15198 100644
--- a/lld/Common/CMakeLists.txt
+++ b/lld/Common/CMakeLists.txt
@@ -2,6 +2,12 @@ if(NOT LLD_BUILT_STANDALONE)
set(tablegen_deps intrinsics_gen)
endif()
+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)
@@ -54,7 +60,7 @@ add_lld_library(lldCommon
Target
LINK_LIBS
- ${LLVM_PTHREAD_LIB}
+ ${LLD_SYSTEM_LIBS}
DEPENDS
${tablegen_deps}
More information about the llvm-branch-commits
mailing list