Skip to content

Commit b8c560f

Browse files
[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.
1 parent 15dacb4 commit b8c560f

File tree

16 files changed

+41
-40
lines changed

16 files changed

+41
-40
lines changed

clang-tools-extra/clang-tidy/tool/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ clang_target_link_libraries(clangTidyMain
3333
# Support plugins.
3434
if(CLANG_PLUGIN_SUPPORT)
3535
set(support_plugins SUPPORT_PLUGINS)
36-
set(export_symbols EXPORT_SYMBOLS_FOR_PLUGINS)
3736
endif()
3837

3938
add_clang_tool(clang-tidy
@@ -42,7 +41,6 @@ add_clang_tool(clang-tidy
4241
DEPENDS
4342
clang-resource-headers
4443
${support_plugins}
45-
${export_symbols}
4644
)
4745
clang_target_link_libraries(clang-tidy
4846
PRIVATE
@@ -59,6 +57,10 @@ target_link_libraries(clang-tidy
5957
${ALL_CLANG_TIDY_CHECKS}
6058
)
6159

60+
if(CLANG_PLUGIN_SUPPORT)
61+
export_executable_symbols_for_plugins(clang-tidy)
62+
endif()
63+
6264
install(PROGRAMS clang-tidy-diff.py
6365
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
6466
COMPONENT clang-tidy)

clang/cmake/modules/AddClang.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ macro(add_clang_tool name)
160160
AND (NOT LLVM_DISTRIBUTION_COMPONENTS OR ${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS)
161161
)
162162
set(get_obj_args ${ARGN})
163-
list(FILTER get_obj_args EXCLUDE REGEX "^(SUPPORT_PLUGINS|EXPORT_SYMBOLS_FOR_PLUGINS)$")
163+
list(FILTER get_obj_args EXCLUDE REGEX "^SUPPORT_PLUGINS$")
164164
generate_llvm_objects(${name} ${get_obj_args})
165165
add_custom_target(${name} DEPENDS llvm-driver clang-resource-headers)
166166
else()

clang/tools/clang-linker-wrapper/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ add_clang_tool(clang-linker-wrapper
3131

3232
DEPENDS
3333
${tablegen_deps}
34-
EXPORT_SYMBOLS_FOR_PLUGINS
3534
)
3635

3736
set(CLANG_LINKER_WRAPPER_LIB_DEPS
@@ -42,3 +41,5 @@ target_link_libraries(clang-linker-wrapper
4241
PRIVATE
4342
${CLANG_LINKER_WRAPPER_LIB_DEPS}
4443
)
44+
45+
export_executable_symbols_for_plugins(clang-linker-wrapper)

clang/tools/clang-repl/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ set( LLVM_LINK_COMPONENTS
99

1010
add_clang_tool(clang-repl
1111
ClangRepl.cpp
12-
13-
EXPORT_SYMBOLS_FOR_PLUGINS
1412
)
1513

1614
if(MSVC)
@@ -63,6 +61,8 @@ clang_target_link_libraries(clang-repl PRIVATE
6361
clangInterpreter
6462
)
6563

64+
export_executable_symbols_for_plugins(clang-repl)
65+
6666
# The clang-repl binary can get huge with static linking in debug mode.
6767
# Some 32-bit targets use PLT slots with limited branch range by default and we
6868
# start to exceed this limit, e.g. when linking for arm-linux-gnueabihf with

clang/tools/driver/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ set( LLVM_LINK_COMPONENTS
2121
# Support plugins.
2222
if(CLANG_PLUGIN_SUPPORT)
2323
set(support_plugins SUPPORT_PLUGINS)
24-
set(export_symbols EXPORT_SYMBOLS_FOR_PLUGINS)
2524
endif()
2625

2726
add_clang_tool(clang
@@ -36,7 +35,6 @@ add_clang_tool(clang
3635
ARMTargetParserTableGen
3736
AArch64TargetParserTableGen
3837
${support_plugins}
39-
${export_symbols}
4038
GENERATE_DRIVER
4139
)
4240

@@ -56,6 +54,11 @@ else()
5654
set_target_properties(clang PROPERTIES VERSION ${CLANG_EXECUTABLE_VERSION})
5755
endif()
5856

57+
# Support plugins.
58+
if(CLANG_PLUGIN_SUPPORT)
59+
export_executable_symbols_for_plugins(clang)
60+
endif()
61+
5962
add_dependencies(clang clang-resource-headers)
6063

6164
if(NOT CLANG_LINKS_TO_CREATE)

flang/tools/flang-driver/CMakeLists.txt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,9 @@ set( LLVM_LINK_COMPONENTS
1111
TargetParser
1212
)
1313

14-
option(FLANG_PLUGIN_SUPPORT "Build Flang with plugin support." ON)
15-
16-
# Enable support for plugins, which need access to symbols from flang-new
17-
if(FLANG_PLUGIN_SUPPORT)
18-
set(export_symbols EXPORT_SYMBOLS_FOR_PLUGINS)
19-
endif()
20-
2114
add_flang_tool(flang-new
2215
driver.cpp
2316
fc1_main.cpp
24-
25-
${export_symbols}
2617
)
2718

2819
target_link_libraries(flang-new
@@ -37,4 +28,11 @@ clang_target_link_libraries(flang-new
3728
clangBasic
3829
)
3930

31+
option(FLANG_PLUGIN_SUPPORT "Build Flang with plugin support." ON)
32+
33+
# Enable support for plugins, which need access to symbols from flang-new
34+
if(FLANG_PLUGIN_SUPPORT)
35+
export_executable_symbols_for_plugins(flang-new)
36+
endif()
37+
4038
install(TARGETS flang-new DESTINATION "${CMAKE_INSTALL_BINDIR}")

lld/cmake/modules/AddLLD.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ macro(add_lld_tool name)
4444
AND (NOT LLVM_DISTRIBUTION_COMPONENTS OR ${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS)
4545
)
4646
set(get_obj_args ${ARGN})
47-
list(FILTER get_obj_args EXCLUDE REGEX "^(SUPPORT_PLUGINS|EXPORT_SYMBOLS_FOR_PLUGINS)$")
47+
list(FILTER get_obj_args EXCLUDE REGEX "^SUPPORT_PLUGINS$")
4848
generate_llvm_objects(${name} ${get_obj_args})
4949
add_custom_target(${name} DEPENDS llvm-driver)
5050
else()

lld/tools/lld/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ add_lld_tool(lld
88

99
SUPPORT_PLUGINS
1010
GENERATE_DRIVER
11-
EXPORT_SYMBOLS_FOR_PLUGINS
1211
)
12+
export_executable_symbols_for_plugins(lld)
1313

1414
function(lld_target_link_libraries target type)
1515
if (TARGET obj.${target})

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ endmacro()
10101010

10111011
macro(add_llvm_executable name)
10121012
cmake_parse_arguments(ARG
1013-
"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH;SUPPORT_PLUGINS;EXPORT_SYMBOLS;EXPORT_SYMBOLS_FOR_PLUGINS"
1013+
"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH;SUPPORT_PLUGINS;EXPORT_SYMBOLS"
10141014
"ENTITLEMENTS;BUNDLE_PATH"
10151015
""
10161016
${ARGN})
@@ -1081,12 +1081,6 @@ macro(add_llvm_executable name)
10811081
endif()
10821082
endif()
10831083

1084-
if (ARG_EXPORT_SYMBOLS)
1085-
export_executable_symbols(${name})
1086-
elseif(ARG_EXPORT_SYMBOLS_FOR_PLUGINS)
1087-
export_executable_symbols_for_plugins(${name})
1088-
endif()
1089-
10901084
if (LLVM_LINK_LLVM_DYLIB AND NOT ARG_DISABLE_LLVM_LINK_LLVM_DYLIB)
10911085
set(USE_SHARED USE_SHARED)
10921086
endif()
@@ -1118,6 +1112,10 @@ macro(add_llvm_executable name)
11181112
endif()
11191113

11201114
llvm_codesign(${name} ENTITLEMENTS ${ARG_ENTITLEMENTS} BUNDLE_PATH ${ARG_BUNDLE_PATH})
1115+
1116+
if (ARG_EXPORT_SYMBOLS)
1117+
export_executable_symbols(${name})
1118+
endif()
11211119
endmacro(add_llvm_executable name)
11221120

11231121
# add_llvm_pass_plugin(name [NO_MODULE] ...)

llvm/tools/bugpoint/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ add_llvm_tool(bugpoint
3737
DEPENDS
3838
intrinsics_gen
3939
SUPPORT_PLUGINS
40-
EXPORT_SYMBOLS_FOR_PLUGINS
4140
)
41+
export_executable_symbols_for_plugins(bugpoint)

llvm/tools/llc/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ add_llvm_tool(llc
3030
DEPENDS
3131
intrinsics_gen
3232
SUPPORT_PLUGINS
33-
EXPORT_SYMBOLS_FOR_PLUGINS
3433
)
34+
35+
export_executable_symbols_for_plugins(llc)

llvm/tools/llvm-lto2/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,5 @@ add_llvm_tool(llvm-lto2
2121

2222
DEPENDS
2323
intrinsics_gen
24-
25-
EXPORT_SYMBOLS_FOR_PLUGINS
2624
)
25+
export_executable_symbols_for_plugins(llvm-lto2)

llvm/tools/opt/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ add_llvm_tool(opt
4545
DEPENDS
4646
intrinsics_gen
4747
SUPPORT_PLUGINS
48-
EXPORT_SYMBOLS_FOR_PLUGINS
4948

5049
)
5150
target_link_libraries(opt PRIVATE LLVMOptDriver)
51+
52+
export_executable_symbols_for_plugins(opt)

llvm/unittests/Analysis/CMakeLists.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,8 @@ else()
6262
LIST(APPEND LLVM_OPTIONAL_SOURCES ${MLGO_TESTS})
6363
endif()
6464

65-
# Export symbols from the plugins shared objects.
66-
if(NOT WIN32)
67-
set(export_symbols EXPORT_SYMBOLS_FOR_PLUGINS)
68-
endif()
69-
7065
add_llvm_unittest_with_input_files(AnalysisTests
7166
${ANALYSIS_TEST_SOURCES}
72-
${export_symbols}
7367
)
7468

7569
add_dependencies(AnalysisTests intrinsics_gen)
@@ -82,5 +76,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
8276
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-brtl")
8377
endif()
8478

79+
# Export symbols from the plugins shared objects.
80+
if(NOT WIN32)
81+
export_executable_symbols_for_plugins(AnalysisTests)
82+
endif()
83+
8584
add_subdirectory(InlineAdvisorPlugin)
8685
add_subdirectory(InlineOrderPlugin)

llvm/unittests/Passes/Plugins/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ if (NOT WIN32 AND NOT CYGWIN)
66
set(LLVM_LINK_COMPONENTS Support Passes Core AsmParser)
77
add_llvm_unittest(PluginsTests
88
PluginsTest.cpp
9-
10-
EXPORT_SYMBOLS_FOR_PLUGINS
119
)
10+
export_executable_symbols_for_plugins(PluginsTests)
1211
target_link_libraries(PluginsTests PRIVATE LLVMTestingSupport)
1312

1413
unset(LLVM_LINK_COMPONENTS)

mlir/tools/mlir-opt/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ add_mlir_tool(mlir-opt
102102
DEPENDS
103103
${LIBS}
104104
SUPPORT_PLUGINS
105-
EXPORT_SYMBOLS_FOR_PLUGINS
106105
)
107106
target_link_libraries(mlir-opt PRIVATE ${LIBS})
108107
llvm_update_compile_flags(mlir-opt)
109108

110109
mlir_check_all_link_libraries(mlir-opt)
110+
export_executable_symbols_for_plugins(mlir-opt)

0 commit comments

Comments
 (0)