Skip to content

Commit 1708358

Browse files
cuviperzmodem
authored andcommitted
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 b26b32b)
1 parent 414f32a commit 1708358

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lld/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
5454
include(AddLLVM)
5555
include(TableGen)
5656
include(HandleLLVMOptions)
57+
include(CheckAtomic)
5758

5859
if(LLVM_INCLUDE_TESTS)
5960
if(CMAKE_VERSION VERSION_LESS 3.12)

lld/Common/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ if(NOT LLD_BUILT_STANDALONE)
22
set(tablegen_deps intrinsics_gen)
33
endif()
44

5+
set(LLD_SYSTEM_LIBS ${LLVM_PTHREAD_LIB})
6+
7+
if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
8+
list(APPEND LLD_SYSTEM_LIBS atomic)
9+
endif()
10+
511
find_first_existing_vc_file("${LLVM_MAIN_SRC_DIR}" llvm_vc)
612
find_first_existing_vc_file("${LLD_SOURCE_DIR}" lld_vc)
713

@@ -54,7 +60,7 @@ add_lld_library(lldCommon
5460
Target
5561

5662
LINK_LIBS
57-
${LLVM_PTHREAD_LIB}
63+
${LLD_SYSTEM_LIBS}
5864

5965
DEPENDS
6066
${tablegen_deps}

0 commit comments

Comments
 (0)