[mlir] [llvm] fix linking on riscv64 (PR #74167)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 1 18:59:37 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
@llvm/pr-subscribers-mlir-core
@llvm/pr-subscribers-debuginfo
Author: Vincent Palatin (vpalatin)
<details>
<summary>Changes</summary>
As libatomic is not included in libgcc_s, when building on riscv64
(on Ubuntu 22.04) using rtlib set to libgcc and gnu ld as the linker,
the linking of a few utilities fails on some __atomic_X symbols provided by libatomic.
For dsymutils, actually reviews.llvm.org/D137799 has commented out the line potentially adding a
`-latomic` when linking by using the LLVM_ATOMIC_LIB variable without providing any reason. Revert this piece of the change.
For several libMLIR consumers, add the LLVM_ATOMIC_LIB variable where needed.
---
Full diff: https://github.com/llvm/llvm-project/pull/74167.diff
4 Files Affected:
- (modified) llvm/tools/dsymutil/CMakeLists.txt (+1-1)
- (modified) mlir/lib/Pass/CMakeLists.txt (+2)
- (modified) mlir/lib/Tools/lsp-server-support/CMakeLists.txt (+2)
- (modified) mlir/tools/mlir-shlib/CMakeLists.txt (+2)
``````````diff
diff --git a/llvm/tools/dsymutil/CMakeLists.txt b/llvm/tools/dsymutil/CMakeLists.txt
index c612bfd9150c47f..de1da71a64dc124 100644
--- a/llvm/tools/dsymutil/CMakeLists.txt
+++ b/llvm/tools/dsymutil/CMakeLists.txt
@@ -44,4 +44,4 @@ if(APPLE AND NOT LLVM_TOOL_LLVM_DRIVER_BUILD)
target_link_libraries(dsymutil PRIVATE "-framework CoreFoundation")
endif(APPLE AND NOT LLVM_TOOL_LLVM_DRIVER_BUILD)
-# target_link_libraries(dsymutil PRIVATE ${LLVM_ATOMIC_LIB})
+target_link_libraries(dsymutil PRIVATE ${LLVM_ATOMIC_LIB})
diff --git a/mlir/lib/Pass/CMakeLists.txt b/mlir/lib/Pass/CMakeLists.txt
index 5ca9b4163bb8a8f..d2628aaa7274ec4 100644
--- a/mlir/lib/Pass/CMakeLists.txt
+++ b/mlir/lib/Pass/CMakeLists.txt
@@ -16,4 +16,6 @@ add_mlir_library(MLIRPass
LINK_LIBS PUBLIC
MLIRAnalysis
MLIRIR
+ PRIVATE
+ ${LLVM_ATOMIC_LIB}
)
diff --git a/mlir/lib/Tools/lsp-server-support/CMakeLists.txt b/mlir/lib/Tools/lsp-server-support/CMakeLists.txt
index 48a96016b792fce..8f7e26340067f1e 100644
--- a/mlir/lib/Tools/lsp-server-support/CMakeLists.txt
+++ b/mlir/lib/Tools/lsp-server-support/CMakeLists.txt
@@ -10,4 +10,6 @@ add_mlir_library(MLIRLspServerSupportLib
LINK_LIBS PUBLIC
MLIRSupport
+ PRIVATE
+ ${LLVM_ATOMIC_LIB}
)
diff --git a/mlir/tools/mlir-shlib/CMakeLists.txt b/mlir/tools/mlir-shlib/CMakeLists.txt
index 32fe833cee4ea78..59e0f7078288355 100644
--- a/mlir/tools/mlir-shlib/CMakeLists.txt
+++ b/mlir/tools/mlir-shlib/CMakeLists.txt
@@ -39,6 +39,8 @@ if(LLVM_BUILD_LLVM_DYLIB)
${_OBJECTS}
LINK_LIBS
${_DEPS}
+ PRIVATE
+ ${LLVM_ATOMIC_LIB}
LINK_COMPONENTS
${mlir_llvm_link_components}
``````````
</details>
https://github.com/llvm/llvm-project/pull/74167
More information about the llvm-commits
mailing list