Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CMake] Remove EXPORT_SYMBOLS_FOR_PLUGINS from #102138 #102396

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions clang-tools-extra/clang-tidy/tool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -42,7 +41,6 @@ add_clang_tool(clang-tidy
DEPENDS
clang-resource-headers
${support_plugins}
${export_symbols}
)
clang_target_link_libraries(clang-tidy
PRIVATE
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion clang/cmake/modules/AddClang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion clang/tools/clang-linker-wrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ add_clang_tool(clang-linker-wrapper

DEPENDS
${tablegen_deps}
EXPORT_SYMBOLS_FOR_PLUGINS
)

set(CLANG_LINKER_WRAPPER_LIB_DEPS
Expand All @@ -42,3 +41,5 @@ target_link_libraries(clang-linker-wrapper
PRIVATE
${CLANG_LINKER_WRAPPER_LIB_DEPS}
)

export_executable_symbols_for_plugins(clang-linker-wrapper)
4 changes: 2 additions & 2 deletions clang/tools/clang-repl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ set( LLVM_LINK_COMPONENTS

add_clang_tool(clang-repl
ClangRepl.cpp

EXPORT_SYMBOLS_FOR_PLUGINS
)

if(MSVC)
Expand Down Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions clang/tools/driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,7 +35,6 @@ add_clang_tool(clang
ARMTargetParserTableGen
AArch64TargetParserTableGen
${support_plugins}
${export_symbols}
GENERATE_DRIVER
)

Expand All @@ -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)
Expand Down
16 changes: 7 additions & 9 deletions flang/tools/flang-driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}")
2 changes: 1 addition & 1 deletion lld/cmake/modules/AddLLD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion lld/tools/lld/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
12 changes: 5 additions & 7 deletions llvm/cmake/modules/AddLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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] ...)
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/bugpoint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ add_llvm_tool(bugpoint
DEPENDS
intrinsics_gen
SUPPORT_PLUGINS
EXPORT_SYMBOLS_FOR_PLUGINS
)
export_executable_symbols_for_plugins(bugpoint)
3 changes: 2 additions & 1 deletion llvm/tools/llc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ add_llvm_tool(llc
DEPENDS
intrinsics_gen
SUPPORT_PLUGINS
EXPORT_SYMBOLS_FOR_PLUGINS
)

export_executable_symbols_for_plugins(llc)
3 changes: 1 addition & 2 deletions llvm/tools/llvm-lto2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ add_llvm_tool(llvm-lto2

DEPENDS
intrinsics_gen

EXPORT_SYMBOLS_FOR_PLUGINS
)
export_executable_symbols_for_plugins(llvm-lto2)
3 changes: 2 additions & 1 deletion llvm/tools/opt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
11 changes: 5 additions & 6 deletions llvm/unittests/Analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
3 changes: 1 addition & 2 deletions llvm/unittests/Passes/Plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion mlir/tools/mlir-opt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading