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

+4-2
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

+2-1
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

+2-2
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

+5-2
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

+2-2
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

+2-2
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

+7-9
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

+1-1
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

+2-2
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

+3-10
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()

llvm/examples/ExceptionDemo/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ endif()
1616

1717
add_llvm_example(ExceptionDemo
1818
ExceptionDemo.cpp
19-
20-
EXPORT_SYMBOLS
2119
)
20+
21+
export_executable_symbols(ExceptionDemo)

llvm/examples/HowToUseLLJIT/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ set(LLVM_LINK_COMPONENTS
77

88
add_llvm_example(HowToUseLLJIT
99
HowToUseLLJIT.cpp
10-
11-
EXPORT_SYMBOLS
1210
)
11+
12+
export_executable_symbols(HowToUseLLJIT)

llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ set(LLVM_LINK_COMPONENTS
1414
add_kaleidoscope_chapter(BuildingAJIT-Ch1
1515
toy.cpp
1616
)
17+
18+
export_executable_symbols(BuildingAJIT-Ch1)

llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ set(LLVM_LINK_COMPONENTS
1414
add_kaleidoscope_chapter(BuildingAJIT-Ch2
1515
toy.cpp
1616
)
17+
18+
export_executable_symbols(BuildingAJIT-Ch2)

llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ set(LLVM_LINK_COMPONENTS
1515
add_kaleidoscope_chapter(BuildingAJIT-Ch3
1616
toy.cpp
1717
)
18+
19+
export_executable_symbols(BuildingAJIT-Ch3)

llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ set(LLVM_LINK_COMPONENTS
1515
add_kaleidoscope_chapter(BuildingAJIT-Ch4
1616
toy.cpp
1717
)
18+
19+
export_executable_symbols(BuildingAJIT-Ch4)

llvm/examples/Kaleidoscope/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set_target_properties(Kaleidoscope PROPERTIES FOLDER "LLVM/Examples")
33

44
macro(add_kaleidoscope_chapter name)
55
add_dependencies(Kaleidoscope ${name})
6-
add_llvm_example(${name} EXPORT_SYMBOLS ${ARGN})
6+
add_llvm_example(${name} ${ARGN})
77
endmacro(add_kaleidoscope_chapter name)
88

99
add_subdirectory(BuildingAJIT)

llvm/examples/Kaleidoscope/Chapter4/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ set(LLVM_LINK_COMPONENTS
1515
add_kaleidoscope_chapter(Kaleidoscope-Ch4
1616
toy.cpp
1717
)
18+
19+
export_executable_symbols(Kaleidoscope-Ch4)

llvm/examples/Kaleidoscope/Chapter5/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ set(LLVM_LINK_COMPONENTS
1515
add_kaleidoscope_chapter(Kaleidoscope-Ch5
1616
toy.cpp
1717
)
18+
19+
export_executable_symbols(Kaleidoscope-Ch5)

llvm/examples/Kaleidoscope/Chapter6/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ set(LLVM_LINK_COMPONENTS
1515
add_kaleidoscope_chapter(Kaleidoscope-Ch6
1616
toy.cpp
1717
)
18+
19+
export_executable_symbols(Kaleidoscope-Ch6)

llvm/examples/Kaleidoscope/Chapter7/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ set(LLVM_LINK_COMPONENTS
1616
add_kaleidoscope_chapter(Kaleidoscope-Ch7
1717
toy.cpp
1818
)
19+
20+
export_executable_symbols(Kaleidoscope-Ch7)

llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ set(LLVM_LINK_COMPONENTS
55
add_kaleidoscope_chapter(Kaleidoscope-Ch8
66
toy.cpp
77
)
8+
9+
export_executable_symbols(Kaleidoscope-Ch8)

llvm/examples/Kaleidoscope/Chapter9/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ set(LLVM_LINK_COMPONENTS
1111
add_kaleidoscope_chapter(Kaleidoscope-Ch9
1212
toy.cpp
1313
)
14+
15+
export_executable_symbols(Kaleidoscope-Ch9)

llvm/examples/OrcV2Examples/LLJITDumpObjects/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ set(LLVM_LINK_COMPONENTS
1111
add_llvm_example(LLJITDumpObjects
1212
LLJITDumpObjects.cpp
1313
)
14+
15+
export_executable_symbols(LLJITDumpObjects)

llvm/examples/OrcV2Examples/LLJITRemovableCode/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ set(LLVM_LINK_COMPONENTS
1212
add_llvm_example(LLJITRemovableCode
1313
LLJITRemovableCode.cpp
1414
)
15+
16+
export_executable_symbols(LLJITRemovableCode)

llvm/examples/OrcV2Examples/LLJITWithCustomObjectLinkingLayer/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ set(LLVM_LINK_COMPONENTS
1010
add_llvm_example(LLJITWithCustomObjectLinkingLayer
1111
LLJITWithCustomObjectLinkingLayer.cpp
1212
)
13+
14+
export_executable_symbols(LLJITWithCustomObjectLinkingLayer)

llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ set(LLVM_LINK_COMPONENTS
1010
add_llvm_example(LLJITWithExecutorProcessControl
1111
LLJITWithExecutorProcessControl.cpp
1212
)
13+
14+
export_executable_symbols(LLJITWithExecutorProcessControl)

llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ set(LLVM_LINK_COMPONENTS
1212
add_llvm_example(LLJITWithGDBRegistrationListener
1313
LLJITWithGDBRegistrationListener.cpp
1414
)
15+
16+
# We want JIT'd code to be able to link against process symbols like printf
17+
# for this example, so make sure they're exported.
18+
export_executable_symbols(LLJITWithGDBRegistrationListener)

llvm/examples/OrcV2Examples/LLJITWithInitializers/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ set(LLVM_LINK_COMPONENTS
1111
add_llvm_example(LLJITWithInitializers
1212
LLJITWithInitializers.cpp
1313
)
14+
15+
export_executable_symbols(LLJITWithInitializers)

llvm/examples/OrcV2Examples/LLJITWithLazyReexports/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ set(LLVM_LINK_COMPONENTS
1010
add_llvm_example(LLJITWithLazyReexports
1111
LLJITWithLazyReexports.cpp
1212
)
13+
14+
export_executable_symbols(LLJITWithLazyReexports)

llvm/examples/OrcV2Examples/LLJITWithObjectCache/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ set(LLVM_LINK_COMPONENTS
1010
add_llvm_example(LLJITWithObjectCache
1111
LLJITWithObjectCache.cpp
1212
)
13+
14+
export_executable_symbols(LLJITWithObjectCache)

llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ set(LLVM_LINK_COMPONENTS
1010
add_llvm_example(LLJITWithObjectLinkingLayerPlugin
1111
LLJITWithObjectLinkingLayerPlugin.cpp
1212
)
13+
14+
export_executable_symbols(LLJITWithObjectLinkingLayerPlugin)

llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ set(LLVM_LINK_COMPONENTS
1212
add_llvm_example(LLJITWithOptimizingIRTransform
1313
LLJITWithOptimizingIRTransform.cpp
1414
)
15+
16+
export_executable_symbols(LLJITWithOptimizingIRTransform)

llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ if (LLVM_INCLUDE_UTILS)
2020
DEPENDS
2121
llvm-jitlink-executor
2222
)
23+
24+
export_executable_symbols(LLJITWithRemoteDebugging)
2325
endif()

llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ set(LLVM_LINK_COMPONENTS
1212
add_llvm_example(LLJITWithThinLTOSummaries
1313
LLJITWithThinLTOSummaries.cpp
1414
)
15+
16+
export_executable_symbols(LLJITWithThinLTOSummaries)

llvm/examples/OrcV2Examples/OrcV2CBindingsAddObjectFile/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ set(LLVM_LINK_COMPONENTS
1313
add_llvm_example(OrcV2CBindingsAddObjectFile
1414
OrcV2CBindingsAddObjectFile.c
1515
)
16+
17+
export_executable_symbols(OrcV2CBindingsAddObjectFile)

llvm/examples/OrcV2Examples/OrcV2CBindingsBasicUsage/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ set(LLVM_LINK_COMPONENTS
1313
add_llvm_example(OrcV2CBindingsBasicUsage
1414
OrcV2CBindingsBasicUsage.c
1515
)
16+
17+
export_executable_symbols(OrcV2CBindingsBasicUsage)

llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ set(LLVM_LINK_COMPONENTS
1313
add_llvm_example(OrcV2CBindingsDumpObjects
1414
OrcV2CBindingsDumpObjects.c
1515
)
16+
17+
export_executable_symbols(OrcV2CBindingsDumpObjects)

0 commit comments

Comments
 (0)