[CMake] Remove EXPORT_SYMBOLS_FOR_PLUGINS from #102138 (#102396)

Partially remove some of the changes from #102138 as
EXPORT_SYMBOLS_FOR_PLUGINS doesn't work on all the configurations.
This commit is contained in:
Steven Wu 2024-08-08 06:00:11 -07:00 committed by GitHub
parent 15dacb452f
commit b8c560f159
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 41 additions and 40 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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}")

View File

@ -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()

View File

@ -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})

View File

@ -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] ...)

View File

@ -37,5 +37,5 @@ add_llvm_tool(bugpoint
DEPENDS
intrinsics_gen
SUPPORT_PLUGINS
EXPORT_SYMBOLS_FOR_PLUGINS
)
export_executable_symbols_for_plugins(bugpoint)

View File

@ -30,5 +30,6 @@ add_llvm_tool(llc
DEPENDS
intrinsics_gen
SUPPORT_PLUGINS
EXPORT_SYMBOLS_FOR_PLUGINS
)
export_executable_symbols_for_plugins(llc)

View File

@ -21,6 +21,5 @@ add_llvm_tool(llvm-lto2
DEPENDS
intrinsics_gen
EXPORT_SYMBOLS_FOR_PLUGINS
)
export_executable_symbols_for_plugins(llvm-lto2)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)