[llvm] 4623c2f - Fix interaction of static plugins with -DLLVM_LINK_LLVM_DYLIB=ON.

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 11:49:28 PDT 2020


Author: Eli Friedman
Date: 2020-04-17T11:49:05-07:00
New Revision: 4623c2ffa4cf39bd94295e8ad1b8ebaaf01a16cc

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

LOG: Fix interaction of static plugins with -DLLVM_LINK_LLVM_DYLIB=ON.

We should link static plugins into libLLVM.so; they shouldn't depend on
libLLVM.so.

Fixes https://bugs.llvm.org/show_bug.cgi?id=45571

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

Added: 
    

Modified: 
    llvm/cmake/modules/AddLLVM.cmake
    polly/lib/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 633a3b0c0514..625d1c74458b 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -883,7 +883,7 @@ function(add_llvm_pass_plugin name)
     list(REMOVE_ITEM ARG_UNPARSED_ARGUMENTS BUILDTREE_ONLY)
     # process_llvm_pass_plugins takes care of the actual linking, just create an
     # object library as of now
-    add_llvm_library(${name} OBJECT ${ARG_UNPARSED_ARGUMENTS})
+    add_llvm_component_library(${name} OBJECT ${ARG_UNPARSED_ARGUMENTS})
     target_compile_definitions(${name} PRIVATE LLVM_${name_upper}_LINK_INTO_TOOLS)
     set_property(TARGET ${name} APPEND PROPERTY COMPILE_DEFINITIONS LLVM_LINK_INTO_TOOLS)
     if (TARGET intrinsics_gen)

diff  --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt
index 35614973a5dd..e754a3103a12 100644
--- a/polly/lib/CMakeLists.txt
+++ b/polly/lib/CMakeLists.txt
@@ -107,7 +107,7 @@ if (GPU_CODEGEN)
   llvm_map_components_to_libnames(nvptx_libs NVPTX)
 endif ()
 
-if (LLVM_LINK_LLVM_DYLIB)
+if (LLVM_LINK_LLVM_DYLIB AND NOT LLVM_POLLY_LINK_INTO_TOOLS)
   # The shlib/dylib contains all the LLVM components
   # (including NVPTX is enabled) already. Adding them to target_link_libraries
   # would cause them being twice in the address space


        


More information about the llvm-commits mailing list