Skip to content

Commit f9b69a3

Browse files
Revert "[CMake] Fold export_executable_symbols_* into function args. (#101741)"
This reverts commit 5c56b46. This break lld build when using GENERATE_DRIVER.
1 parent a0fa9a3 commit f9b69a3

File tree

56 files changed

+123
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+123
-68
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/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)

clang/unittests/Interpreter/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ add_clang_unittest(ClangReplInterpreterTests
1313
InterpreterTest.cpp
1414
InterpreterExtensionsTest.cpp
1515
CodeCompletionTest.cpp
16-
17-
EXPORT_SYMBOLS
1816
)
1917
target_link_libraries(ClangReplInterpreterTests PUBLIC
2018
clangAST
@@ -30,6 +28,8 @@ if(NOT WIN32)
3028
add_subdirectory(ExceptionTests)
3129
endif()
3230

31+
export_executable_symbols(ClangReplInterpreterTests)
32+
3333
if(MSVC)
3434
set_target_properties(ClangReplInterpreterTests PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS 1)
3535

clang/unittests/Interpreter/ExceptionTests/CMakeLists.txt

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

1313
add_clang_unittest(ClangReplInterpreterExceptionTests
1414
InterpreterExceptionTest.cpp
15-
16-
EXPORT_SYMBOLS
1715
)
1816

1917
llvm_update_compile_flags(ClangReplInterpreterExceptionTests)
@@ -24,3 +22,5 @@ target_link_libraries(ClangReplInterpreterExceptionTests PUBLIC
2422
clangFrontend
2523
)
2624
add_dependencies(ClangReplInterpreterExceptionTests clang-resource-headers)
25+
26+
export_executable_symbols(ClangReplInterpreterExceptionTests)

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/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/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
11971197
endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
11981198

11991199
# Make sure we don't get -rdynamic in every binary. For those that need it,
1200-
# use EXPORT_SYMBOLS argument.
1200+
# use export_executable_symbols(target).
12011201
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
12021202

12031203
include(AddLLVM)
@@ -1238,7 +1238,7 @@ if( LLVM_INCLUDE_UTILS )
12381238
if( LLVM_INCLUDE_TESTS )
12391239
set(LLVM_SUBPROJECT_TITLE "Third-Party/Google Test")
12401240
add_subdirectory(${LLVM_THIRD_PARTY_DIR}/unittest ${CMAKE_CURRENT_BINARY_DIR}/third-party/unittest)
1241-
set(LLVM_SUBPROJECT_TITLE)
1241+
set(LLVM_SUBPROJECT_TITLE)
12421242
endif()
12431243
else()
12441244
if ( LLVM_INCLUDE_TESTS )

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 3 additions & 10 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"
10141014
"ENTITLEMENTS;BUNDLE_PATH"
10151015
""
10161016
${ARGN})
@@ -1070,8 +1070,7 @@ macro(add_llvm_executable name)
10701070
endif(LLVM_EXPORTED_SYMBOL_FILE)
10711071

10721072
if (DEFINED LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES AND
1073-
NOT LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES AND
1074-
NOT ARG_EXPORT_SYMBOLS AND NOT ARG_EXPORT_SYMBOLS_FOR_PLUGINS)
1073+
NOT LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES)
10751074
if(LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS)
10761075
set_property(TARGET ${name} APPEND_STRING PROPERTY
10771076
LINK_FLAGS " -Wl,-no_exported_symbols")
@@ -1081,12 +1080,6 @@ macro(add_llvm_executable name)
10811080
endif()
10821081
endif()
10831082

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-
10901083
if (LLVM_LINK_LLVM_DYLIB AND NOT ARG_DISABLE_LLVM_LINK_LLVM_DYLIB)
10911084
set(USE_SHARED USE_SHARED)
10921085
endif()
@@ -1471,7 +1464,7 @@ macro(add_llvm_example name)
14711464
if( NOT LLVM_BUILD_EXAMPLES )
14721465
set(EXCLUDE_FROM_ALL ON)
14731466
endif()
1474-
add_llvm_executable(${name} EXPORT_SYMBOLS ${ARGN})
1467+
add_llvm_executable(${name} ${ARGN})
14751468
if( LLVM_BUILD_EXAMPLES )
14761469
install(TARGETS ${name} RUNTIME DESTINATION "${LLVM_EXAMPLES_INSTALL_DIR}")
14771470
endif()

0 commit comments

Comments
 (0)