Skip to content

Commit 0627e7d

Browse files
committed
lld: link libatomic if needed for Timer
D80298 made Timer::total atomic, but this requires linking libatomic on some targets. This has been submitted as D85691 to fix our arm-unknown-linux-gnueabi build, but there's concern about targets that don't even have libatomic. See also: https://bugs.llvm.org/show_bug.cgi?id=47123
1 parent 07a48ea commit 0627e7d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-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: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
set(LLD_SYSTEM_LIBS ${LLVM_PTHREAD_LIB})
2+
3+
# See also: https://bugs.llvm.org/show_bug.cgi?id=47123
4+
if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
5+
list(APPEND LLD_SYSTEM_LIBS atomic)
6+
endif()
7+
18
if(NOT LLD_BUILT_STANDALONE)
29
set(tablegen_deps intrinsics_gen)
310
endif()
@@ -54,7 +61,7 @@ add_lld_library(lldCommon
5461
Target
5562

5663
LINK_LIBS
57-
${LLVM_PTHREAD_LIB}
64+
${LLD_SYSTEM_LIBS}
5865

5966
DEPENDS
6067
${tablegen_deps}

0 commit comments

Comments
 (0)