[clang] f9b69a3 - Revert "[CMake] Fold export_executable_symbols_* into function args. (#101741)"

Steven Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 6 06:08:44 PDT 2024


Author: Steven Wu
Date: 2024-08-06T06:08:16-07:00
New Revision: f9b69a378cb1acfedab7252b4d4dc3d0af282d0b

URL: https://github.com/llvm/llvm-project/commit/f9b69a378cb1acfedab7252b4d4dc3d0af282d0b
DIFF: https://github.com/llvm/llvm-project/commit/f9b69a378cb1acfedab7252b4d4dc3d0af282d0b.diff

LOG: Revert "[CMake] Fold export_executable_symbols_* into function args. (#101741)"

This reverts commit 5c56b46a32a8856a022a54291bc9294068f7ddbd. This break
lld build when using GENERATE_DRIVER.

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/tool/CMakeLists.txt
    clang/tools/clang-linker-wrapper/CMakeLists.txt
    clang/tools/clang-repl/CMakeLists.txt
    clang/tools/driver/CMakeLists.txt
    clang/unittests/Interpreter/CMakeLists.txt
    clang/unittests/Interpreter/ExceptionTests/CMakeLists.txt
    flang/tools/flang-driver/CMakeLists.txt
    lld/tools/lld/CMakeLists.txt
    llvm/CMakeLists.txt
    llvm/cmake/modules/AddLLVM.cmake
    llvm/examples/ExceptionDemo/CMakeLists.txt
    llvm/examples/HowToUseLLJIT/CMakeLists.txt
    llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/CMakeLists.txt
    llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/CMakeLists.txt
    llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/CMakeLists.txt
    llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/CMakeLists.txt
    llvm/examples/Kaleidoscope/CMakeLists.txt
    llvm/examples/Kaleidoscope/Chapter4/CMakeLists.txt
    llvm/examples/Kaleidoscope/Chapter5/CMakeLists.txt
    llvm/examples/Kaleidoscope/Chapter6/CMakeLists.txt
    llvm/examples/Kaleidoscope/Chapter7/CMakeLists.txt
    llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt
    llvm/examples/Kaleidoscope/Chapter9/CMakeLists.txt
    llvm/examples/OrcV2Examples/LLJITDumpObjects/CMakeLists.txt
    llvm/examples/OrcV2Examples/LLJITRemovableCode/CMakeLists.txt
    llvm/examples/OrcV2Examples/LLJITWithCustomObjectLinkingLayer/CMakeLists.txt
    llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/CMakeLists.txt
    llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener/CMakeLists.txt
    llvm/examples/OrcV2Examples/LLJITWithInitializers/CMakeLists.txt
    llvm/examples/OrcV2Examples/LLJITWithLazyReexports/CMakeLists.txt
    llvm/examples/OrcV2Examples/LLJITWithObjectCache/CMakeLists.txt
    llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/CMakeLists.txt
    llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/CMakeLists.txt
    llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/CMakeLists.txt
    llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/CMakeLists.txt
    llvm/examples/OrcV2Examples/OrcV2CBindingsAddObjectFile/CMakeLists.txt
    llvm/examples/OrcV2Examples/OrcV2CBindingsBasicUsage/CMakeLists.txt
    llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects/CMakeLists.txt
    llvm/examples/OrcV2Examples/OrcV2CBindingsIRTransforms/CMakeLists.txt
    llvm/examples/OrcV2Examples/OrcV2CBindingsLazy/CMakeLists.txt
    llvm/examples/OrcV2Examples/OrcV2CBindingsRemovableCode/CMakeLists.txt
    llvm/examples/OrcV2Examples/OrcV2CBindingsVeryLazy/CMakeLists.txt
    llvm/tools/bugpoint/CMakeLists.txt
    llvm/tools/llc/CMakeLists.txt
    llvm/tools/lli/CMakeLists.txt
    llvm/tools/lli/ChildTarget/CMakeLists.txt
    llvm/tools/llvm-jitlink/CMakeLists.txt
    llvm/tools/llvm-jitlink/llvm-jitlink-executor/CMakeLists.txt
    llvm/tools/llvm-lto2/CMakeLists.txt
    llvm/tools/opt/CMakeLists.txt
    llvm/unittests/Analysis/CMakeLists.txt
    llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt
    llvm/unittests/Passes/Plugins/CMakeLists.txt
    llvm/unittests/Support/DynamicLibrary/CMakeLists.txt
    mlir/tools/mlir-cpu-runner/CMakeLists.txt
    mlir/tools/mlir-opt/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/tool/CMakeLists.txt b/clang-tools-extra/clang-tidy/tool/CMakeLists.txt
index 9f327ce838b70..b220cbea80f1b 100644
--- a/clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -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)

diff  --git a/clang/tools/clang-linker-wrapper/CMakeLists.txt b/clang/tools/clang-linker-wrapper/CMakeLists.txt
index 4a16c3ca9f090..bf37d8031025e 100644
--- a/clang/tools/clang-linker-wrapper/CMakeLists.txt
+++ b/clang/tools/clang-linker-wrapper/CMakeLists.txt
@@ -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)

diff  --git a/clang/tools/clang-repl/CMakeLists.txt b/clang/tools/clang-repl/CMakeLists.txt
index 52b740b356284..a35ff13494e11 100644
--- a/clang/tools/clang-repl/CMakeLists.txt
+++ b/clang/tools/clang-repl/CMakeLists.txt
@@ -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

diff  --git a/clang/tools/driver/CMakeLists.txt b/clang/tools/driver/CMakeLists.txt
index 805dffb0d9b70..018605c2fd4f2 100644
--- a/clang/tools/driver/CMakeLists.txt
+++ b/clang/tools/driver/CMakeLists.txt
@@ -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)

diff  --git a/clang/unittests/Interpreter/CMakeLists.txt b/clang/unittests/Interpreter/CMakeLists.txt
index ec6f81ea19b96..c0fd2d8f3777a 100644
--- a/clang/unittests/Interpreter/CMakeLists.txt
+++ b/clang/unittests/Interpreter/CMakeLists.txt
@@ -13,8 +13,6 @@ add_clang_unittest(ClangReplInterpreterTests
   InterpreterTest.cpp
   InterpreterExtensionsTest.cpp
   CodeCompletionTest.cpp
-
-  EXPORT_SYMBOLS
   )
 target_link_libraries(ClangReplInterpreterTests PUBLIC
   clangAST
@@ -30,6 +28,8 @@ if(NOT WIN32)
   add_subdirectory(ExceptionTests)
 endif()
 
+export_executable_symbols(ClangReplInterpreterTests)
+
 if(MSVC)
   set_target_properties(ClangReplInterpreterTests PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS 1)
 

diff  --git a/clang/unittests/Interpreter/ExceptionTests/CMakeLists.txt b/clang/unittests/Interpreter/ExceptionTests/CMakeLists.txt
index 24ae9cd78b5ca..5a6597d1b6728 100644
--- a/clang/unittests/Interpreter/ExceptionTests/CMakeLists.txt
+++ b/clang/unittests/Interpreter/ExceptionTests/CMakeLists.txt
@@ -12,8 +12,6 @@ set(LLVM_LINK_COMPONENTS
 
 add_clang_unittest(ClangReplInterpreterExceptionTests
   InterpreterExceptionTest.cpp
-
-  EXPORT_SYMBOLS
   )
 
 llvm_update_compile_flags(ClangReplInterpreterExceptionTests)
@@ -24,3 +22,5 @@ target_link_libraries(ClangReplInterpreterExceptionTests PUBLIC
   clangFrontend
   )
 add_dependencies(ClangReplInterpreterExceptionTests clang-resource-headers)
+
+export_executable_symbols(ClangReplInterpreterExceptionTests)

diff  --git a/flang/tools/flang-driver/CMakeLists.txt b/flang/tools/flang-driver/CMakeLists.txt
index baa9496002835..9f33cdfe3fa90 100644
--- a/flang/tools/flang-driver/CMakeLists.txt
+++ b/flang/tools/flang-driver/CMakeLists.txt
@@ -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}")

diff  --git a/lld/tools/lld/CMakeLists.txt b/lld/tools/lld/CMakeLists.txt
index 630d38f770a7f..8498a91597a93 100644
--- a/lld/tools/lld/CMakeLists.txt
+++ b/lld/tools/lld/CMakeLists.txt
@@ -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})

diff  --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 51f99cb696257..699de1ccd870c 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -1197,7 +1197,7 @@ if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
 endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
 
 # Make sure we don't get -rdynamic in every binary. For those that need it,
-# use EXPORT_SYMBOLS argument.
+# use export_executable_symbols(target).
 set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
 
 include(AddLLVM)
@@ -1238,7 +1238,7 @@ if( LLVM_INCLUDE_UTILS )
   if( LLVM_INCLUDE_TESTS )
     set(LLVM_SUBPROJECT_TITLE "Third-Party/Google Test")
     add_subdirectory(${LLVM_THIRD_PARTY_DIR}/unittest ${CMAKE_CURRENT_BINARY_DIR}/third-party/unittest)
-    set(LLVM_SUBPROJECT_TITLE)
+    set(LLVM_SUBPROJECT_TITLE) 
   endif()
 else()
   if ( LLVM_INCLUDE_TESTS )

diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 257dc2250bb4e..bb4e9963d0913 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -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"
     "ENTITLEMENTS;BUNDLE_PATH"
     ""
     ${ARGN})
@@ -1070,8 +1070,7 @@ macro(add_llvm_executable name)
   endif(LLVM_EXPORTED_SYMBOL_FILE)
 
   if (DEFINED LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES AND
-      NOT LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES AND
-      NOT ARG_EXPORT_SYMBOLS AND NOT ARG_EXPORT_SYMBOLS_FOR_PLUGINS)
+      NOT LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES)
     if(LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS)
       set_property(TARGET ${name} APPEND_STRING PROPERTY
         LINK_FLAGS " -Wl,-no_exported_symbols")
@@ -1081,12 +1080,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()
@@ -1471,7 +1464,7 @@ macro(add_llvm_example name)
   if( NOT LLVM_BUILD_EXAMPLES )
     set(EXCLUDE_FROM_ALL ON)
   endif()
-  add_llvm_executable(${name} EXPORT_SYMBOLS ${ARGN})
+  add_llvm_executable(${name} ${ARGN})
   if( LLVM_BUILD_EXAMPLES )
     install(TARGETS ${name} RUNTIME DESTINATION "${LLVM_EXAMPLES_INSTALL_DIR}")
   endif()

diff  --git a/llvm/examples/ExceptionDemo/CMakeLists.txt b/llvm/examples/ExceptionDemo/CMakeLists.txt
index 6c125fe20fb6f..793cf291ca6f1 100644
--- a/llvm/examples/ExceptionDemo/CMakeLists.txt
+++ b/llvm/examples/ExceptionDemo/CMakeLists.txt
@@ -16,6 +16,6 @@ endif()
 
 add_llvm_example(ExceptionDemo
   ExceptionDemo.cpp
-
-  EXPORT_SYMBOLS
   )
+
+export_executable_symbols(ExceptionDemo)

diff  --git a/llvm/examples/HowToUseLLJIT/CMakeLists.txt b/llvm/examples/HowToUseLLJIT/CMakeLists.txt
index ca5e190c61338..3ca99e5598e76 100644
--- a/llvm/examples/HowToUseLLJIT/CMakeLists.txt
+++ b/llvm/examples/HowToUseLLJIT/CMakeLists.txt
@@ -7,6 +7,6 @@ set(LLVM_LINK_COMPONENTS
 
 add_llvm_example(HowToUseLLJIT
   HowToUseLLJIT.cpp
-
-  EXPORT_SYMBOLS
   )
+
+export_executable_symbols(HowToUseLLJIT)

diff  --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/CMakeLists.txt b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/CMakeLists.txt
index d4b7c3fed547d..72c9668f7d3af 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/CMakeLists.txt
@@ -14,3 +14,5 @@ set(LLVM_LINK_COMPONENTS
 add_kaleidoscope_chapter(BuildingAJIT-Ch1
   toy.cpp
   )
+
+export_executable_symbols(BuildingAJIT-Ch1)

diff  --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/CMakeLists.txt b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/CMakeLists.txt
index 9fd9e8860b2f9..ba6abd72d4282 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/CMakeLists.txt
@@ -14,3 +14,5 @@ set(LLVM_LINK_COMPONENTS
 add_kaleidoscope_chapter(BuildingAJIT-Ch2
   toy.cpp
   )
+
+export_executable_symbols(BuildingAJIT-Ch2)

diff  --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/CMakeLists.txt b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/CMakeLists.txt
index cf82552162e01..51800a64b1e30 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/CMakeLists.txt
@@ -15,3 +15,5 @@ set(LLVM_LINK_COMPONENTS
 add_kaleidoscope_chapter(BuildingAJIT-Ch3
   toy.cpp
   )
+
+export_executable_symbols(BuildingAJIT-Ch3)

diff  --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/CMakeLists.txt b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/CMakeLists.txt
index 241192fa01c93..7cd40a1da60dc 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/CMakeLists.txt
@@ -15,3 +15,5 @@ set(LLVM_LINK_COMPONENTS
 add_kaleidoscope_chapter(BuildingAJIT-Ch4
   toy.cpp
   )
+
+export_executable_symbols(BuildingAJIT-Ch4)

diff  --git a/llvm/examples/Kaleidoscope/CMakeLists.txt b/llvm/examples/Kaleidoscope/CMakeLists.txt
index 3cc6733c7d307..6ad3b61566472 100644
--- a/llvm/examples/Kaleidoscope/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/CMakeLists.txt
@@ -3,7 +3,7 @@ set_target_properties(Kaleidoscope PROPERTIES FOLDER "LLVM/Examples")
 
 macro(add_kaleidoscope_chapter name)
   add_dependencies(Kaleidoscope ${name})
-  add_llvm_example(${name} EXPORT_SYMBOLS ${ARGN})
+  add_llvm_example(${name} ${ARGN})
 endmacro(add_kaleidoscope_chapter name)
 
 add_subdirectory(BuildingAJIT)

diff  --git a/llvm/examples/Kaleidoscope/Chapter4/CMakeLists.txt b/llvm/examples/Kaleidoscope/Chapter4/CMakeLists.txt
index dcb82ffad4b8d..5281941fec874 100644
--- a/llvm/examples/Kaleidoscope/Chapter4/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/Chapter4/CMakeLists.txt
@@ -15,3 +15,5 @@ set(LLVM_LINK_COMPONENTS
 add_kaleidoscope_chapter(Kaleidoscope-Ch4
   toy.cpp
   )
+
+export_executable_symbols(Kaleidoscope-Ch4)

diff  --git a/llvm/examples/Kaleidoscope/Chapter5/CMakeLists.txt b/llvm/examples/Kaleidoscope/Chapter5/CMakeLists.txt
index 9639f440d200c..35fb1b7911b86 100644
--- a/llvm/examples/Kaleidoscope/Chapter5/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/Chapter5/CMakeLists.txt
@@ -15,3 +15,5 @@ set(LLVM_LINK_COMPONENTS
 add_kaleidoscope_chapter(Kaleidoscope-Ch5
   toy.cpp
   )
+
+export_executable_symbols(Kaleidoscope-Ch5)

diff  --git a/llvm/examples/Kaleidoscope/Chapter6/CMakeLists.txt b/llvm/examples/Kaleidoscope/Chapter6/CMakeLists.txt
index 0baf3f483e1ba..627d682bdc57f 100644
--- a/llvm/examples/Kaleidoscope/Chapter6/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/Chapter6/CMakeLists.txt
@@ -15,3 +15,5 @@ set(LLVM_LINK_COMPONENTS
 add_kaleidoscope_chapter(Kaleidoscope-Ch6
   toy.cpp
   )
+
+export_executable_symbols(Kaleidoscope-Ch6)

diff  --git a/llvm/examples/Kaleidoscope/Chapter7/CMakeLists.txt b/llvm/examples/Kaleidoscope/Chapter7/CMakeLists.txt
index 2167b4cf55e2c..f4d8bd9e20c38 100644
--- a/llvm/examples/Kaleidoscope/Chapter7/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/Chapter7/CMakeLists.txt
@@ -16,3 +16,5 @@ set(LLVM_LINK_COMPONENTS
 add_kaleidoscope_chapter(Kaleidoscope-Ch7
   toy.cpp
   )
+
+export_executable_symbols(Kaleidoscope-Ch7)

diff  --git a/llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt b/llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt
index 29c02c9dbc720..1bb1cd25af72d 100644
--- a/llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt
@@ -5,3 +5,5 @@ set(LLVM_LINK_COMPONENTS
 add_kaleidoscope_chapter(Kaleidoscope-Ch8
   toy.cpp
   )
+
+export_executable_symbols(Kaleidoscope-Ch8)

diff  --git a/llvm/examples/Kaleidoscope/Chapter9/CMakeLists.txt b/llvm/examples/Kaleidoscope/Chapter9/CMakeLists.txt
index d21ba342ebe5a..a5d1a45108872 100644
--- a/llvm/examples/Kaleidoscope/Chapter9/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/Chapter9/CMakeLists.txt
@@ -11,3 +11,5 @@ set(LLVM_LINK_COMPONENTS
 add_kaleidoscope_chapter(Kaleidoscope-Ch9
   toy.cpp
   )
+
+export_executable_symbols(Kaleidoscope-Ch9)

diff  --git a/llvm/examples/OrcV2Examples/LLJITDumpObjects/CMakeLists.txt b/llvm/examples/OrcV2Examples/LLJITDumpObjects/CMakeLists.txt
index 3d83ee6864d33..42b9d1c4f9ae8 100644
--- a/llvm/examples/OrcV2Examples/LLJITDumpObjects/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/LLJITDumpObjects/CMakeLists.txt
@@ -11,3 +11,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(LLJITDumpObjects
   LLJITDumpObjects.cpp
   )
+
+export_executable_symbols(LLJITDumpObjects)

diff  --git a/llvm/examples/OrcV2Examples/LLJITRemovableCode/CMakeLists.txt b/llvm/examples/OrcV2Examples/LLJITRemovableCode/CMakeLists.txt
index 3ab58c1c1f308..2c0036f625607 100644
--- a/llvm/examples/OrcV2Examples/LLJITRemovableCode/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/LLJITRemovableCode/CMakeLists.txt
@@ -12,3 +12,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(LLJITRemovableCode
   LLJITRemovableCode.cpp
   )
+
+export_executable_symbols(LLJITRemovableCode)

diff  --git a/llvm/examples/OrcV2Examples/LLJITWithCustomObjectLinkingLayer/CMakeLists.txt b/llvm/examples/OrcV2Examples/LLJITWithCustomObjectLinkingLayer/CMakeLists.txt
index 6034fc6791127..85e11ec1368e0 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithCustomObjectLinkingLayer/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/LLJITWithCustomObjectLinkingLayer/CMakeLists.txt
@@ -10,3 +10,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(LLJITWithCustomObjectLinkingLayer
   LLJITWithCustomObjectLinkingLayer.cpp
   )
+
+export_executable_symbols(LLJITWithCustomObjectLinkingLayer)

diff  --git a/llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/CMakeLists.txt b/llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/CMakeLists.txt
index 47f50ca746440..65a5b1bb3a404 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/CMakeLists.txt
@@ -10,3 +10,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(LLJITWithExecutorProcessControl
   LLJITWithExecutorProcessControl.cpp
   )
+
+export_executable_symbols(LLJITWithExecutorProcessControl)

diff  --git a/llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener/CMakeLists.txt b/llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener/CMakeLists.txt
index 61864201ddec6..12fe6346ea4e7 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener/CMakeLists.txt
@@ -12,3 +12,7 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(LLJITWithGDBRegistrationListener
   LLJITWithGDBRegistrationListener.cpp
   )
+
+# We want JIT'd code to be able to link against process symbols like printf
+# for this example, so make sure they're exported.
+export_executable_symbols(LLJITWithGDBRegistrationListener)

diff  --git a/llvm/examples/OrcV2Examples/LLJITWithInitializers/CMakeLists.txt b/llvm/examples/OrcV2Examples/LLJITWithInitializers/CMakeLists.txt
index 302647564ab81..ed466f4e40652 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithInitializers/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/LLJITWithInitializers/CMakeLists.txt
@@ -11,3 +11,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(LLJITWithInitializers
   LLJITWithInitializers.cpp
   )
+
+export_executable_symbols(LLJITWithInitializers)

diff  --git a/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/CMakeLists.txt b/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/CMakeLists.txt
index cdff74b10ad03..2ed22e161139c 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/CMakeLists.txt
@@ -10,3 +10,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(LLJITWithLazyReexports
   LLJITWithLazyReexports.cpp
   )
+
+export_executable_symbols(LLJITWithLazyReexports)

diff  --git a/llvm/examples/OrcV2Examples/LLJITWithObjectCache/CMakeLists.txt b/llvm/examples/OrcV2Examples/LLJITWithObjectCache/CMakeLists.txt
index c5f8fd6a97a7f..a4eaaadf01521 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithObjectCache/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/LLJITWithObjectCache/CMakeLists.txt
@@ -10,3 +10,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(LLJITWithObjectCache
   LLJITWithObjectCache.cpp
   )
+
+export_executable_symbols(LLJITWithObjectCache)

diff  --git a/llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/CMakeLists.txt b/llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/CMakeLists.txt
index 54814621a5a5f..6177d4596e369 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/CMakeLists.txt
@@ -10,3 +10,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(LLJITWithObjectLinkingLayerPlugin
   LLJITWithObjectLinkingLayerPlugin.cpp
   )
+
+export_executable_symbols(LLJITWithObjectLinkingLayerPlugin)

diff  --git a/llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/CMakeLists.txt b/llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/CMakeLists.txt
index a9cd91ad596ad..b40e30911c4a9 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/CMakeLists.txt
@@ -12,3 +12,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(LLJITWithOptimizingIRTransform
   LLJITWithOptimizingIRTransform.cpp
   )
+
+export_executable_symbols(LLJITWithOptimizingIRTransform)

diff  --git a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/CMakeLists.txt b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/CMakeLists.txt
index 6052622ba0d6e..51b3925f4a9e7 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/CMakeLists.txt
@@ -20,4 +20,6 @@ if (LLVM_INCLUDE_UTILS)
     DEPENDS
       llvm-jitlink-executor
   )
+
+  export_executable_symbols(LLJITWithRemoteDebugging)
 endif()

diff  --git a/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/CMakeLists.txt b/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/CMakeLists.txt
index 5ce2fb498f334..148b1aaa10833 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/CMakeLists.txt
@@ -12,3 +12,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(LLJITWithThinLTOSummaries
   LLJITWithThinLTOSummaries.cpp
   )
+
+export_executable_symbols(LLJITWithThinLTOSummaries)

diff  --git a/llvm/examples/OrcV2Examples/OrcV2CBindingsAddObjectFile/CMakeLists.txt b/llvm/examples/OrcV2Examples/OrcV2CBindingsAddObjectFile/CMakeLists.txt
index cc50112f326ea..376ee1d8af5d4 100644
--- a/llvm/examples/OrcV2Examples/OrcV2CBindingsAddObjectFile/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/OrcV2CBindingsAddObjectFile/CMakeLists.txt
@@ -13,3 +13,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(OrcV2CBindingsAddObjectFile
   OrcV2CBindingsAddObjectFile.c
   )
+
+export_executable_symbols(OrcV2CBindingsAddObjectFile)

diff  --git a/llvm/examples/OrcV2Examples/OrcV2CBindingsBasicUsage/CMakeLists.txt b/llvm/examples/OrcV2Examples/OrcV2CBindingsBasicUsage/CMakeLists.txt
index 0f18d6c24912f..3e0ac3971dc45 100644
--- a/llvm/examples/OrcV2Examples/OrcV2CBindingsBasicUsage/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/OrcV2CBindingsBasicUsage/CMakeLists.txt
@@ -13,3 +13,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(OrcV2CBindingsBasicUsage
   OrcV2CBindingsBasicUsage.c
   )
+
+export_executable_symbols(OrcV2CBindingsBasicUsage)

diff  --git a/llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects/CMakeLists.txt b/llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects/CMakeLists.txt
index 8e2c97d782062..ad927d191a570 100644
--- a/llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects/CMakeLists.txt
@@ -13,3 +13,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(OrcV2CBindingsDumpObjects
   OrcV2CBindingsDumpObjects.c
   )
+
+export_executable_symbols(OrcV2CBindingsDumpObjects)

diff  --git a/llvm/examples/OrcV2Examples/OrcV2CBindingsIRTransforms/CMakeLists.txt b/llvm/examples/OrcV2Examples/OrcV2CBindingsIRTransforms/CMakeLists.txt
index af1b43e43e111..c90534c87954c 100644
--- a/llvm/examples/OrcV2Examples/OrcV2CBindingsIRTransforms/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/OrcV2CBindingsIRTransforms/CMakeLists.txt
@@ -14,3 +14,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(OrcV2CBindingsIRTransforms
   OrcV2CBindingsIRTransforms.c
   )
+
+export_executable_symbols(OrcV2CBindingsIRTransforms)

diff  --git a/llvm/examples/OrcV2Examples/OrcV2CBindingsLazy/CMakeLists.txt b/llvm/examples/OrcV2Examples/OrcV2CBindingsLazy/CMakeLists.txt
index 52eb2d496fc23..74238cbce8af3 100644
--- a/llvm/examples/OrcV2Examples/OrcV2CBindingsLazy/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/OrcV2CBindingsLazy/CMakeLists.txt
@@ -13,3 +13,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(OrcV2CBindingsLazy
   OrcV2CBindingsLazy.c
   )
+
+export_executable_symbols(OrcV2CBindingsLazy)

diff  --git a/llvm/examples/OrcV2Examples/OrcV2CBindingsRemovableCode/CMakeLists.txt b/llvm/examples/OrcV2Examples/OrcV2CBindingsRemovableCode/CMakeLists.txt
index 5b737557bb1ef..65299ff871f18 100644
--- a/llvm/examples/OrcV2Examples/OrcV2CBindingsRemovableCode/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/OrcV2CBindingsRemovableCode/CMakeLists.txt
@@ -13,3 +13,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(OrcV2CBindingsRemovableCode
   OrcV2CBindingsRemovableCode.c
   )
+
+export_executable_symbols(OrcV2CBindingsRemovableCode)

diff  --git a/llvm/examples/OrcV2Examples/OrcV2CBindingsVeryLazy/CMakeLists.txt b/llvm/examples/OrcV2Examples/OrcV2CBindingsVeryLazy/CMakeLists.txt
index 0bc9610b1ad7e..5d3e730e29e25 100644
--- a/llvm/examples/OrcV2Examples/OrcV2CBindingsVeryLazy/CMakeLists.txt
+++ b/llvm/examples/OrcV2Examples/OrcV2CBindingsVeryLazy/CMakeLists.txt
@@ -13,3 +13,5 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_example(OrcV2CBindingsVeryLazy
   OrcV2CBindingsVeryLazy.c
   )
+
+export_executable_symbols(OrcV2CBindingsVeryLazy)

diff  --git a/llvm/tools/bugpoint/CMakeLists.txt b/llvm/tools/bugpoint/CMakeLists.txt
index f846aed24b75e..b0e71910c7cc3 100644
--- a/llvm/tools/bugpoint/CMakeLists.txt
+++ b/llvm/tools/bugpoint/CMakeLists.txt
@@ -37,5 +37,5 @@ add_llvm_tool(bugpoint
   DEPENDS
   intrinsics_gen
   SUPPORT_PLUGINS
-  EXPORT_SYMBOLS_FOR_PLUGINS
   )
+export_executable_symbols_for_plugins(bugpoint)

diff  --git a/llvm/tools/llc/CMakeLists.txt b/llvm/tools/llc/CMakeLists.txt
index c5407944dd213..01825c6e4c64c 100644
--- a/llvm/tools/llc/CMakeLists.txt
+++ b/llvm/tools/llc/CMakeLists.txt
@@ -30,5 +30,6 @@ add_llvm_tool(llc
   DEPENDS
   intrinsics_gen
   SUPPORT_PLUGINS
-  EXPORT_SYMBOLS_FOR_PLUGINS
   )
+
+export_executable_symbols_for_plugins(llc)

diff  --git a/llvm/tools/lli/CMakeLists.txt b/llvm/tools/lli/CMakeLists.txt
index 3106f25ad79f8..e3fca225a2275 100644
--- a/llvm/tools/lli/CMakeLists.txt
+++ b/llvm/tools/lli/CMakeLists.txt
@@ -56,6 +56,6 @@ add_llvm_tool(lli
 
   DEPENDS
   intrinsics_gen
-
-  EXPORT_SYMBOLS
   )
+
+export_executable_symbols(lli)

diff  --git a/llvm/tools/lli/ChildTarget/CMakeLists.txt b/llvm/tools/lli/ChildTarget/CMakeLists.txt
index b3c1dd25ed75d..5a81faa70f014 100644
--- a/llvm/tools/lli/ChildTarget/CMakeLists.txt
+++ b/llvm/tools/lli/ChildTarget/CMakeLists.txt
@@ -10,6 +10,6 @@ add_llvm_utility(lli-child-target
 
   DEPENDS
   intrinsics_gen
-
-  EXPORT_SYMBOLS
 )
+
+export_executable_symbols(lli-child-target)

diff  --git a/llvm/tools/llvm-jitlink/CMakeLists.txt b/llvm/tools/llvm-jitlink/CMakeLists.txt
index e337fe5f99865..1487e7897f600 100644
--- a/llvm/tools/llvm-jitlink/CMakeLists.txt
+++ b/llvm/tools/llvm-jitlink/CMakeLists.txt
@@ -26,8 +26,6 @@ add_llvm_tool(llvm-jitlink
   llvm-jitlink-elf.cpp
   llvm-jitlink-macho.cpp
   llvm-jitlink-statistics.cpp
-
-  EXPORT_SYMBOLS
   )
 
 if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
@@ -37,3 +35,5 @@ endif()
 if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
   target_link_libraries(llvm-jitlink PRIVATE socket)
 endif()
+
+export_executable_symbols(llvm-jitlink)

diff  --git a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/CMakeLists.txt b/llvm/tools/llvm-jitlink/llvm-jitlink-executor/CMakeLists.txt
index f2daa294eec07..f6d882d1a8f06 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/CMakeLists.txt
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink-executor/CMakeLists.txt
@@ -9,6 +9,6 @@ add_llvm_utility(llvm-jitlink-executor
 
   DEPENDS
   intrinsics_gen
-
-  EXPORT_SYMBOLS
 )
+
+export_executable_symbols(llvm-jitlink-executor)

diff  --git a/llvm/tools/llvm-lto2/CMakeLists.txt b/llvm/tools/llvm-lto2/CMakeLists.txt
index 335392fb8990a..3b4644d6e2771 100644
--- a/llvm/tools/llvm-lto2/CMakeLists.txt
+++ b/llvm/tools/llvm-lto2/CMakeLists.txt
@@ -21,6 +21,5 @@ add_llvm_tool(llvm-lto2
 
   DEPENDS
   intrinsics_gen
-
-  EXPORT_SYMBOLS_FOR_PLUGINS
   )
+export_executable_symbols_for_plugins(llvm-lto2)

diff  --git a/llvm/tools/opt/CMakeLists.txt b/llvm/tools/opt/CMakeLists.txt
index c235fcf1ac960..8d031b2cc57c7 100644
--- a/llvm/tools/opt/CMakeLists.txt
+++ b/llvm/tools/opt/CMakeLists.txt
@@ -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)

diff  --git a/llvm/unittests/Analysis/CMakeLists.txt b/llvm/unittests/Analysis/CMakeLists.txt
index a1199adba076a..3cba630867a83 100644
--- a/llvm/unittests/Analysis/CMakeLists.txt
+++ b/llvm/unittests/Analysis/CMakeLists.txt
@@ -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)

diff  --git a/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt b/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt
index dc3380d35fda9..cc868e7587dc6 100644
--- a/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt
+++ b/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt
@@ -43,10 +43,10 @@ add_llvm_unittest(OrcJITTests
   TaskDispatchTest.cpp
   ThreadSafeModuleTest.cpp
   WrapperFunctionUtilsTest.cpp
-
-  EXPORT_SYMBOLS
   )
 
 target_link_libraries(OrcJITTests PRIVATE
                         LLVMTestingSupport
                         ${ORC_JIT_TEST_LIBS})
+
+export_executable_symbols(OrcJITTests)

diff  --git a/llvm/unittests/Passes/Plugins/CMakeLists.txt b/llvm/unittests/Passes/Plugins/CMakeLists.txt
index 55d7e715014f4..e90cae167bc22 100644
--- a/llvm/unittests/Passes/Plugins/CMakeLists.txt
+++ b/llvm/unittests/Passes/Plugins/CMakeLists.txt
@@ -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)

diff  --git a/llvm/unittests/Support/DynamicLibrary/CMakeLists.txt b/llvm/unittests/Support/DynamicLibrary/CMakeLists.txt
index d8dff1ef4a3f7..4574acd629068 100644
--- a/llvm/unittests/Support/DynamicLibrary/CMakeLists.txt
+++ b/llvm/unittests/Support/DynamicLibrary/CMakeLists.txt
@@ -17,10 +17,9 @@ set_output_directory(DynamicLibraryLib
 
 add_llvm_unittest(DynamicLibraryTests
   DynamicLibraryTest.cpp
-
-  EXPORT_SYMBOLS
   )
 target_link_libraries(DynamicLibraryTests PRIVATE DynamicLibraryLib)
+export_executable_symbols(DynamicLibraryTests)
 
 function(dynlib_add_module NAME)
   add_library(${NAME} MODULE
@@ -39,7 +38,7 @@ function(dynlib_add_module NAME)
     )
 
   add_dependencies(DynamicLibraryTests ${NAME})
-
+  
   if(LLVM_INTEGRATED_CRT_ALLOC)
     # We need to link in the Support lib for the Memory allocator override,
     # otherwise the DynamicLibrary.Shutdown test will fail, because it would
@@ -49,7 +48,7 @@ function(dynlib_add_module NAME)
     llvm_map_components_to_libnames(llvm_libs Support)
     target_link_libraries(${NAME} ${llvm_libs} "-INCLUDE:malloc")
   endif()
-
+  
 endfunction(dynlib_add_module)
 
 # Revert -Wl,-z,nodelete on this test since it relies on the file

diff  --git a/mlir/tools/mlir-cpu-runner/CMakeLists.txt b/mlir/tools/mlir-cpu-runner/CMakeLists.txt
index ae6dbceca855d..1766b28aa0b11 100644
--- a/mlir/tools/mlir-cpu-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-cpu-runner/CMakeLists.txt
@@ -7,8 +7,6 @@ set(LLVM_LINK_COMPONENTS
 
 add_mlir_tool(mlir-cpu-runner
   mlir-cpu-runner.cpp
-
-  EXPORT_SYMBOLS
   )
 llvm_update_compile_flags(mlir-cpu-runner)
 target_link_libraries(mlir-cpu-runner PRIVATE
@@ -24,3 +22,5 @@ target_link_libraries(mlir-cpu-runner PRIVATE
   MLIRTargetLLVMIRExport
   MLIRSupport
   )
+
+export_executable_symbols(mlir-cpu-runner)

diff  --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt
index 1209c53d81bfb..8b79de58fa102 100644
--- a/mlir/tools/mlir-opt/CMakeLists.txt
+++ b/mlir/tools/mlir-opt/CMakeLists.txt
@@ -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)


        


More information about the cfe-commits mailing list