[llvm] 1a14436 - Make sure libLLVM users link with libatomic if needed
Aaron Puchert via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 18 10:12:32 PDT 2022
Author: Aaron Puchert
Date: 2022-09-18T19:11:57+02:00
New Revision: 1a14436c35b4738a22554cc4a7349bfcf3ceea78
URL: https://github.com/llvm/llvm-project/commit/1a14436c35b4738a22554cc4a7349bfcf3ceea78
DIFF: https://github.com/llvm/llvm-project/commit/1a14436c35b4738a22554cc4a7349bfcf3ceea78.diff
LOG: Make sure libLLVM users link with libatomic if needed
64-bit atomics are used in llvm/ADT/Statistic.h, which means that users
of libLLVM.so might also have to link with libatomic. To avoid having
to special-case the library here, we simply add all `LLVM_SYSTEM_LIBS`
as public link dependencies to libLLVM.
This fixes a build failure on PowerPC 32-bit.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D132799
Added:
Modified:
llvm/tools/llvm-shlib/CMakeLists.txt
Removed:
################################################################################
diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt b/llvm/tools/llvm-shlib/CMakeLists.txt
index fd4999fff6764..eb4d9891c929c 100644
--- a/llvm/tools/llvm-shlib/CMakeLists.txt
+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
@@ -63,6 +63,10 @@ if(LLVM_BUILD_LLVM_DYLIB)
target_link_libraries(LLVM PRIVATE ${LIB_NAMES})
+ if(LLVM_ENABLE_THREADS AND NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
+ target_link_libraries(LLVM PUBLIC atomic)
+ endif()
+
if (APPLE)
set_property(TARGET LLVM APPEND_STRING PROPERTY
LINK_FLAGS
More information about the llvm-commits
mailing list