[Mlir-commits] [mlir] d94f70f - [mlir] Improve LLVM shlib support

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Oct 8 22:18:41 PDT 2020


Author: Serge Guelton
Date: 2020-10-09T07:17:56+02:00
New Revision: d94f70fb98b8077537ad3ca90673ee94204db1e9

URL: https://github.com/llvm/llvm-project/commit/d94f70fb98b8077537ad3ca90673ee94204db1e9
DIFF: https://github.com/llvm/llvm-project/commit/d94f70fb98b8077537ad3ca90673ee94204db1e9.diff

LOG: [mlir] Improve LLVM shlib support

mlir-tblgen was incompatible with libLLVM, due to explicit linkage with
libLLVMSupport etc.
As it cannot link with libLLVM, make sure all lib it uses are not using libLLVM
either.

As a side effect, also remove some explicit references to LLVM libs and use
components instead.

Differential Revision: https://reviews.llvm.org/D88846

Added: 
    

Modified: 
    mlir/lib/Support/CMakeLists.txt
    mlir/tools/mlir-cuda-runner/CMakeLists.txt
    mlir/tools/mlir-rocm-runner/CMakeLists.txt
    mlir/tools/mlir-tblgen/CMakeLists.txt
    mlir/tools/mlir-vulkan-runner/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Support/CMakeLists.txt b/mlir/lib/Support/CMakeLists.txt
index df72bc97cef1..2c2820c480ed 100644
--- a/mlir/lib/Support/CMakeLists.txt
+++ b/mlir/lib/Support/CMakeLists.txt
@@ -34,6 +34,8 @@ add_mlir_library(MLIROptLib
 add_llvm_library(MLIRSupportIndentedOstream
   IndentedOstream.cpp
 
-  LINK_LIBS PUBLIC
-  LLVMSupport
+  DISABLE_LLVM_LINK_LLVM_DYLIB
+
+  LINK_COMPONENTS
+  Support
   )

diff  --git a/mlir/tools/mlir-cuda-runner/CMakeLists.txt b/mlir/tools/mlir-cuda-runner/CMakeLists.txt
index 5488262d7ee7..38e6ac5b5b86 100644
--- a/mlir/tools/mlir-cuda-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-cuda-runner/CMakeLists.txt
@@ -41,8 +41,6 @@ if(MLIR_CUDA_RUNNER_ENABLED)
   set(LIBS
     ${dialect_libs}
     ${conversion_libs}
-    LLVMCore
-    LLVMSupport
     MLIRJitRunner
     MLIRAnalysis
     MLIREDSC
@@ -73,6 +71,10 @@ if(MLIR_CUDA_RUNNER_ENABLED)
 
     DEPENDS
     cuda-runtime-wrappers
+
+    LINK_COMPONENTS
+    Core
+    Support
     )
   target_include_directories(mlir-cuda-runner
     PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}

diff  --git a/mlir/tools/mlir-rocm-runner/CMakeLists.txt b/mlir/tools/mlir-rocm-runner/CMakeLists.txt
index 2c0791d7a5c1..a4da49673027 100644
--- a/mlir/tools/mlir-rocm-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-rocm-runner/CMakeLists.txt
@@ -72,12 +72,6 @@ if(MLIR_ROCM_RUNNER_ENABLED)
     lldCommon
     lldDriver
     lldELF
-    LLVMCore
-    LLVMLTO
-    LLVMMC
-    LLVMMCParser
-    LLVMOption
-    LLVMSupport
     MLIRJitRunner
     MLIRAnalysis
     MLIREDSC
@@ -109,6 +103,15 @@ if(MLIR_ROCM_RUNNER_ENABLED)
 
     DEPENDS
     rocm-runtime-wrappers
+
+    LINK_COMPONENTS
+
+    Core
+    LTO
+    MC
+    MCParser
+    Option
+    Support
     )
   llvm_update_compile_flags(mlir-rocm-runner)
   target_include_directories(mlir-rocm-runner

diff  --git a/mlir/tools/mlir-tblgen/CMakeLists.txt b/mlir/tools/mlir-tblgen/CMakeLists.txt
index 40447a89082f..3bcaeb9e6b49 100644
--- a/mlir/tools/mlir-tblgen/CMakeLists.txt
+++ b/mlir/tools/mlir-tblgen/CMakeLists.txt
@@ -1,8 +1,3 @@
-set(LLVM_LINK_COMPONENTS
-  Demangle
-  Support
-  TableGen
-  )
 
 add_tablegen(mlir-tblgen MLIR
   DialectGen.cpp

diff  --git a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
index c7a03259bb83..b329068ae2ad 100644
--- a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
@@ -57,8 +57,6 @@ if (MLIR_VULKAN_RUNNER_ENABLED)
   set(LIBS
     ${dialect_libs}
     ${conversion_libs}
-    LLVMCore
-    LLVMSupport
     MLIRAnalysis
     MLIREDSC
     MLIRExecutionEngine
@@ -87,6 +85,10 @@ if (MLIR_VULKAN_RUNNER_ENABLED)
 
   add_llvm_tool(mlir-vulkan-runner
     mlir-vulkan-runner.cpp
+
+    LINK_COMPONENTS
+    Core
+    Support
   )
   add_dependencies(mlir-vulkan-runner vulkan-runtime-wrappers)
   llvm_update_compile_flags(mlir-vulkan-runner)


        


More information about the Mlir-commits mailing list