[Mlir-commits] [clang] [clang-tools-extra] [flang] [lld] [llvm] [mlir] [CMake] Remove EXPORT_SYMBOLS_FOR_PLUGINS from #102138 (PR #102396)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Aug 7 15:10:57 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lld
@llvm/pr-subscribers-clang
@llvm/pr-subscribers-clang-tidy
Author: Steven Wu (cachemeifyoucan)
<details>
<summary>Changes</summary>
Partially remove some of the changes from #<!-- -->102138 as
EXPORT_SYMBOLS_FOR_PLUGINS doesn't work on all the configurations.
---
Full diff: https://github.com/llvm/llvm-project/pull/102396.diff
16 Files Affected:
- (modified) clang-tools-extra/clang-tidy/tool/CMakeLists.txt (+4-2)
- (modified) clang/cmake/modules/AddClang.cmake (+1-1)
- (modified) clang/tools/clang-linker-wrapper/CMakeLists.txt (+2-1)
- (modified) clang/tools/clang-repl/CMakeLists.txt (+2-2)
- (modified) clang/tools/driver/CMakeLists.txt (+5-2)
- (modified) flang/tools/flang-driver/CMakeLists.txt (+7-9)
- (modified) lld/cmake/modules/AddLLD.cmake (+1-1)
- (modified) lld/tools/lld/CMakeLists.txt (+1-1)
- (modified) llvm/cmake/modules/AddLLVM.cmake (+5-7)
- (modified) llvm/tools/bugpoint/CMakeLists.txt (+1-1)
- (modified) llvm/tools/llc/CMakeLists.txt (+2-1)
- (modified) llvm/tools/llvm-lto2/CMakeLists.txt (+1-2)
- (modified) llvm/tools/opt/CMakeLists.txt (+2-1)
- (modified) llvm/unittests/Analysis/CMakeLists.txt (+5-6)
- (modified) llvm/unittests/Passes/Plugins/CMakeLists.txt (+1-2)
- (modified) mlir/tools/mlir-opt/CMakeLists.txt (+1-1)
``````````diff
diff --git a/clang-tools-extra/clang-tidy/tool/CMakeLists.txt b/clang-tools-extra/clang-tidy/tool/CMakeLists.txt
index 9f327ce838b70..b220cbea80f1b 100644
--- a/clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -33,7 +33,6 @@ clang_target_link_libraries(clangTidyMain
# Support plugins.
if(CLANG_PLUGIN_SUPPORT)
set(support_plugins SUPPORT_PLUGINS)
- set(export_symbols EXPORT_SYMBOLS_FOR_PLUGINS)
endif()
add_clang_tool(clang-tidy
@@ -42,7 +41,6 @@ add_clang_tool(clang-tidy
DEPENDS
clang-resource-headers
${support_plugins}
- ${export_symbols}
)
clang_target_link_libraries(clang-tidy
PRIVATE
@@ -59,6 +57,10 @@ target_link_libraries(clang-tidy
${ALL_CLANG_TIDY_CHECKS}
)
+if(CLANG_PLUGIN_SUPPORT)
+ export_executable_symbols_for_plugins(clang-tidy)
+endif()
+
install(PROGRAMS clang-tidy-diff.py
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
COMPONENT clang-tidy)
diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
index 9f264720b1e9e..5327b5d2f0892 100644
--- a/clang/cmake/modules/AddClang.cmake
+++ b/clang/cmake/modules/AddClang.cmake
@@ -160,7 +160,7 @@ macro(add_clang_tool name)
AND (NOT LLVM_DISTRIBUTION_COMPONENTS OR ${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS)
)
set(get_obj_args ${ARGN})
- list(FILTER get_obj_args EXCLUDE REGEX "^(SUPPORT_PLUGINS|EXPORT_SYMBOLS_FOR_PLUGINS)$")
+ list(FILTER get_obj_args EXCLUDE REGEX "^SUPPORT_PLUGINS$")
generate_llvm_objects(${name} ${get_obj_args})
add_custom_target(${name} DEPENDS llvm-driver clang-resource-headers)
else()
diff --git a/clang/tools/clang-linker-wrapper/CMakeLists.txt b/clang/tools/clang-linker-wrapper/CMakeLists.txt
index 4a16c3ca9f090..bf37d8031025e 100644
--- a/clang/tools/clang-linker-wrapper/CMakeLists.txt
+++ b/clang/tools/clang-linker-wrapper/CMakeLists.txt
@@ -31,7 +31,6 @@ add_clang_tool(clang-linker-wrapper
DEPENDS
${tablegen_deps}
- EXPORT_SYMBOLS_FOR_PLUGINS
)
set(CLANG_LINKER_WRAPPER_LIB_DEPS
@@ -42,3 +41,5 @@ target_link_libraries(clang-linker-wrapper
PRIVATE
${CLANG_LINKER_WRAPPER_LIB_DEPS}
)
+
+export_executable_symbols_for_plugins(clang-linker-wrapper)
diff --git a/clang/tools/clang-repl/CMakeLists.txt b/clang/tools/clang-repl/CMakeLists.txt
index 52b740b356284..a35ff13494e11 100644
--- a/clang/tools/clang-repl/CMakeLists.txt
+++ b/clang/tools/clang-repl/CMakeLists.txt
@@ -9,8 +9,6 @@ set( LLVM_LINK_COMPONENTS
add_clang_tool(clang-repl
ClangRepl.cpp
-
- EXPORT_SYMBOLS_FOR_PLUGINS
)
if(MSVC)
@@ -63,6 +61,8 @@ clang_target_link_libraries(clang-repl PRIVATE
clangInterpreter
)
+export_executable_symbols_for_plugins(clang-repl)
+
# The clang-repl binary can get huge with static linking in debug mode.
# Some 32-bit targets use PLT slots with limited branch range by default and we
# start to exceed this limit, e.g. when linking for arm-linux-gnueabihf with
diff --git a/clang/tools/driver/CMakeLists.txt b/clang/tools/driver/CMakeLists.txt
index 805dffb0d9b70..018605c2fd4f2 100644
--- a/clang/tools/driver/CMakeLists.txt
+++ b/clang/tools/driver/CMakeLists.txt
@@ -21,7 +21,6 @@ set( LLVM_LINK_COMPONENTS
# Support plugins.
if(CLANG_PLUGIN_SUPPORT)
set(support_plugins SUPPORT_PLUGINS)
- set(export_symbols EXPORT_SYMBOLS_FOR_PLUGINS)
endif()
add_clang_tool(clang
@@ -36,7 +35,6 @@ add_clang_tool(clang
ARMTargetParserTableGen
AArch64TargetParserTableGen
${support_plugins}
- ${export_symbols}
GENERATE_DRIVER
)
@@ -56,6 +54,11 @@ else()
set_target_properties(clang PROPERTIES VERSION ${CLANG_EXECUTABLE_VERSION})
endif()
+# Support plugins.
+if(CLANG_PLUGIN_SUPPORT)
+ export_executable_symbols_for_plugins(clang)
+endif()
+
add_dependencies(clang clang-resource-headers)
if(NOT CLANG_LINKS_TO_CREATE)
diff --git a/flang/tools/flang-driver/CMakeLists.txt b/flang/tools/flang-driver/CMakeLists.txt
index baa9496002835..9f33cdfe3fa90 100644
--- a/flang/tools/flang-driver/CMakeLists.txt
+++ b/flang/tools/flang-driver/CMakeLists.txt
@@ -11,18 +11,9 @@ set( LLVM_LINK_COMPONENTS
TargetParser
)
-option(FLANG_PLUGIN_SUPPORT "Build Flang with plugin support." ON)
-
-# Enable support for plugins, which need access to symbols from flang-new
-if(FLANG_PLUGIN_SUPPORT)
- set(export_symbols EXPORT_SYMBOLS_FOR_PLUGINS)
-endif()
-
add_flang_tool(flang-new
driver.cpp
fc1_main.cpp
-
- ${export_symbols}
)
target_link_libraries(flang-new
@@ -37,4 +28,11 @@ clang_target_link_libraries(flang-new
clangBasic
)
+option(FLANG_PLUGIN_SUPPORT "Build Flang with plugin support." ON)
+
+# Enable support for plugins, which need access to symbols from flang-new
+if(FLANG_PLUGIN_SUPPORT)
+ export_executable_symbols_for_plugins(flang-new)
+endif()
+
install(TARGETS flang-new DESTINATION "${CMAKE_INSTALL_BINDIR}")
diff --git a/lld/cmake/modules/AddLLD.cmake b/lld/cmake/modules/AddLLD.cmake
index 34f9974efbf50..9f2684b6f933e 100644
--- a/lld/cmake/modules/AddLLD.cmake
+++ b/lld/cmake/modules/AddLLD.cmake
@@ -44,7 +44,7 @@ macro(add_lld_tool name)
AND (NOT LLVM_DISTRIBUTION_COMPONENTS OR ${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS)
)
set(get_obj_args ${ARGN})
- list(FILTER get_obj_args EXCLUDE REGEX "^(SUPPORT_PLUGINS|EXPORT_SYMBOLS_FOR_PLUGINS)$")
+ list(FILTER get_obj_args EXCLUDE REGEX "^SUPPORT_PLUGINS$")
generate_llvm_objects(${name} ${get_obj_args})
add_custom_target(${name} DEPENDS llvm-driver)
else()
diff --git a/lld/tools/lld/CMakeLists.txt b/lld/tools/lld/CMakeLists.txt
index 630d38f770a7f..8498a91597a93 100644
--- a/lld/tools/lld/CMakeLists.txt
+++ b/lld/tools/lld/CMakeLists.txt
@@ -8,8 +8,8 @@ add_lld_tool(lld
SUPPORT_PLUGINS
GENERATE_DRIVER
- EXPORT_SYMBOLS_FOR_PLUGINS
)
+export_executable_symbols_for_plugins(lld)
function(lld_target_link_libraries target type)
if (TARGET obj.${target})
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 257dc2250bb4e..3e7e3a965559a 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1010,7 +1010,7 @@ endmacro()
macro(add_llvm_executable name)
cmake_parse_arguments(ARG
- "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH;SUPPORT_PLUGINS;EXPORT_SYMBOLS;EXPORT_SYMBOLS_FOR_PLUGINS"
+ "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH;SUPPORT_PLUGINS;EXPORT_SYMBOLS"
"ENTITLEMENTS;BUNDLE_PATH"
""
${ARGN})
@@ -1081,12 +1081,6 @@ macro(add_llvm_executable name)
endif()
endif()
- if (ARG_EXPORT_SYMBOLS)
- export_executable_symbols(${name})
- elseif(ARG_EXPORT_SYMBOLS_FOR_PLUGINS)
- export_executable_symbols_for_plugins(${name})
- endif()
-
if (LLVM_LINK_LLVM_DYLIB AND NOT ARG_DISABLE_LLVM_LINK_LLVM_DYLIB)
set(USE_SHARED USE_SHARED)
endif()
@@ -1118,6 +1112,10 @@ macro(add_llvm_executable name)
endif()
llvm_codesign(${name} ENTITLEMENTS ${ARG_ENTITLEMENTS} BUNDLE_PATH ${ARG_BUNDLE_PATH})
+
+ if (ARG_EXPORT_SYMBOLS)
+ export_executable_symbols(${name})
+ endif()
endmacro(add_llvm_executable name)
# add_llvm_pass_plugin(name [NO_MODULE] ...)
diff --git a/llvm/tools/bugpoint/CMakeLists.txt b/llvm/tools/bugpoint/CMakeLists.txt
index f846aed24b75e..b0e71910c7cc3 100644
--- a/llvm/tools/bugpoint/CMakeLists.txt
+++ b/llvm/tools/bugpoint/CMakeLists.txt
@@ -37,5 +37,5 @@ add_llvm_tool(bugpoint
DEPENDS
intrinsics_gen
SUPPORT_PLUGINS
- EXPORT_SYMBOLS_FOR_PLUGINS
)
+export_executable_symbols_for_plugins(bugpoint)
diff --git a/llvm/tools/llc/CMakeLists.txt b/llvm/tools/llc/CMakeLists.txt
index c5407944dd213..01825c6e4c64c 100644
--- a/llvm/tools/llc/CMakeLists.txt
+++ b/llvm/tools/llc/CMakeLists.txt
@@ -30,5 +30,6 @@ add_llvm_tool(llc
DEPENDS
intrinsics_gen
SUPPORT_PLUGINS
- EXPORT_SYMBOLS_FOR_PLUGINS
)
+
+export_executable_symbols_for_plugins(llc)
diff --git a/llvm/tools/llvm-lto2/CMakeLists.txt b/llvm/tools/llvm-lto2/CMakeLists.txt
index 335392fb8990a..3b4644d6e2771 100644
--- a/llvm/tools/llvm-lto2/CMakeLists.txt
+++ b/llvm/tools/llvm-lto2/CMakeLists.txt
@@ -21,6 +21,5 @@ add_llvm_tool(llvm-lto2
DEPENDS
intrinsics_gen
-
- EXPORT_SYMBOLS_FOR_PLUGINS
)
+export_executable_symbols_for_plugins(llvm-lto2)
diff --git a/llvm/tools/opt/CMakeLists.txt b/llvm/tools/opt/CMakeLists.txt
index c235fcf1ac960..8d031b2cc57c7 100644
--- a/llvm/tools/opt/CMakeLists.txt
+++ b/llvm/tools/opt/CMakeLists.txt
@@ -45,7 +45,8 @@ add_llvm_tool(opt
DEPENDS
intrinsics_gen
SUPPORT_PLUGINS
- EXPORT_SYMBOLS_FOR_PLUGINS
)
target_link_libraries(opt PRIVATE LLVMOptDriver)
+
+export_executable_symbols_for_plugins(opt)
diff --git a/llvm/unittests/Analysis/CMakeLists.txt b/llvm/unittests/Analysis/CMakeLists.txt
index a1199adba076a..3cba630867a83 100644
--- a/llvm/unittests/Analysis/CMakeLists.txt
+++ b/llvm/unittests/Analysis/CMakeLists.txt
@@ -62,14 +62,8 @@ else()
LIST(APPEND LLVM_OPTIONAL_SOURCES ${MLGO_TESTS})
endif()
-# Export symbols from the plugins shared objects.
-if(NOT WIN32)
- set(export_symbols EXPORT_SYMBOLS_FOR_PLUGINS)
-endif()
-
add_llvm_unittest_with_input_files(AnalysisTests
${ANALYSIS_TEST_SOURCES}
- ${export_symbols}
)
add_dependencies(AnalysisTests intrinsics_gen)
@@ -82,5 +76,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-brtl")
endif()
+# Export symbols from the plugins shared objects.
+if(NOT WIN32)
+ export_executable_symbols_for_plugins(AnalysisTests)
+endif()
+
add_subdirectory(InlineAdvisorPlugin)
add_subdirectory(InlineOrderPlugin)
diff --git a/llvm/unittests/Passes/Plugins/CMakeLists.txt b/llvm/unittests/Passes/Plugins/CMakeLists.txt
index 55d7e715014f4..e90cae167bc22 100644
--- a/llvm/unittests/Passes/Plugins/CMakeLists.txt
+++ b/llvm/unittests/Passes/Plugins/CMakeLists.txt
@@ -6,9 +6,8 @@ if (NOT WIN32 AND NOT CYGWIN)
set(LLVM_LINK_COMPONENTS Support Passes Core AsmParser)
add_llvm_unittest(PluginsTests
PluginsTest.cpp
-
- EXPORT_SYMBOLS_FOR_PLUGINS
)
+ export_executable_symbols_for_plugins(PluginsTests)
target_link_libraries(PluginsTests PRIVATE LLVMTestingSupport)
unset(LLVM_LINK_COMPONENTS)
diff --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt
index 1209c53d81bfb..8b79de58fa102 100644
--- a/mlir/tools/mlir-opt/CMakeLists.txt
+++ b/mlir/tools/mlir-opt/CMakeLists.txt
@@ -102,9 +102,9 @@ add_mlir_tool(mlir-opt
DEPENDS
${LIBS}
SUPPORT_PLUGINS
- EXPORT_SYMBOLS_FOR_PLUGINS
)
target_link_libraries(mlir-opt PRIVATE ${LIBS})
llvm_update_compile_flags(mlir-opt)
mlir_check_all_link_libraries(mlir-opt)
+export_executable_symbols_for_plugins(mlir-opt)
``````````
</details>
https://github.com/llvm/llvm-project/pull/102396
More information about the Mlir-commits
mailing list