diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -418,7 +418,7 @@ else() llvm_process_sources(ALL_FILES ${ARG_UNPARSED_ARGUMENTS} ${ARG_ADDITIONAL_HEADERS}) endif() - if(ARG_ENABLE_PLUGINS) + if(ARG_ENABLE_PLUGINS AND NOT LLVM_LINK_LLVM_DYLIB) set_property(GLOBAL APPEND PROPERTY LLVM_PLUGIN_TARGETS ${name}) endif() diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt b/llvm/tools/llvm-shlib/CMakeLists.txt --- a/llvm/tools/llvm-shlib/CMakeLists.txt +++ b/llvm/tools/llvm-shlib/CMakeLists.txt @@ -96,7 +96,7 @@ add_custom_target(libLLVMCExports DEPENDS ${LLVM_EXPORTED_SYMBOL_FILE}) - add_llvm_library(LLVM-C SHARED ${SOURCES} INSTALL_WITH_TOOLCHAIN) + add_llvm_library(LLVM-C SHARED ${SOURCES} INSTALL_WITH_TOOLCHAIN ENABLE_PLUGINS) target_link_libraries(LLVM-C PUBLIC LLVM) add_dependencies(LLVM-C libLLVMCExports) @@ -170,6 +170,6 @@ VERBATIM ) # Finally link the target. - add_llvm_library(LLVM-C SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES} DEPENDS intrinsics_gen) + add_llvm_library(LLVM-C SHARED INSTALL_WITH_TOOLCHAIN ENABLE_PLUGINS ${SOURCES} DEPENDS intrinsics_gen) endif() diff --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt --- a/polly/lib/CMakeLists.txt +++ b/polly/lib/CMakeLists.txt @@ -106,15 +106,13 @@ llvm_map_components_to_libnames(nvptx_libs NVPTX) endif () -if (LLVM_LINK_LLVM_DYLIB) - # 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 - # (their LLVM*.a/so and their copies in libLLVM.so) - # which results in errors when the two instances try to register the same - # command-line switches. - target_link_libraries(Polly PUBLIC LLVM) -else () +# 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 +# (their LLVM*.a/so and their copies in libLLVM.so) +# which results in errors when the two instances try to register the same +# command-line switches. +if (NOT LLVM_LINK_LLVM_DYLIB) target_link_libraries(Polly PUBLIC LLVMSupport LLVMCore