[PATCH] D74464: Fix integration of pass plugins with llvm dylib
serge via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 12 00:06:48 PST 2020
serge-sans-paille created this revision.
serge-sans-paille added reviewers: Meinersbur, hans.
Herald added subscribers: llvm-commits, mgorny.
Herald added a reviewer: bollu.
Herald added a project: LLVM.
- link pass plugins within DYLIB if it is built
- if DYLIB is used to link instead of individual components, do not add pass plugin to plugin targets, as they are already linked into the DYLIB
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D74464
Files:
llvm/cmake/modules/AddLLVM.cmake
llvm/tools/llvm-shlib/CMakeLists.txt
polly/lib/CMakeLists.txt
Index: polly/lib/CMakeLists.txt
===================================================================
--- polly/lib/CMakeLists.txt
+++ 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
Index: llvm/tools/llvm-shlib/CMakeLists.txt
===================================================================
--- llvm/tools/llvm-shlib/CMakeLists.txt
+++ 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()
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ 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()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74464.244074.patch
Type: text/x-patch
Size: 2402 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200212/697b8e54/attachment.bin>
More information about the llvm-commits
mailing list