Author: Eli Friedman Date: 2020-03-23T12:17:09-07:00 New Revision: 896335bfb8ea2c09c361c4f1e5a9aa6fb78caf88
URL: https://github.com/llvm/llvm-project/commit/896335bfb8ea2c09c361c4f1e5a9aa6fb78caf88 DIFF: https://github.com/llvm/llvm-project/commit/896335bfb8ea2c09c361c4f1e5a9aa6fb78caf88.diff LOG: Don't export symbols from clang/opt/llc if plugins are disabled. The only reason we export symbols from these tools is to support plugins; if we don't have plugins, exporting symbols just bloats the executable and makes LTO less effective. See review of D75879 for the discussion that led to this patch. Differential Revision: https://reviews.llvm.org/D76527 Added: Modified: clang/tools/driver/CMakeLists.txt llvm/cmake/modules/AddLLVM.cmake llvm/tools/bugpoint/CMakeLists.txt llvm/tools/llc/CMakeLists.txt llvm/tools/llvm-stress/CMakeLists.txt llvm/tools/opt/CMakeLists.txt llvm/unittests/Passes/CMakeLists.txt Removed: ################################################################################ diff --git a/clang/tools/driver/CMakeLists.txt b/clang/tools/driver/CMakeLists.txt index 2b783cff0955..c53485ef1957 100644 --- a/clang/tools/driver/CMakeLists.txt +++ b/clang/tools/driver/CMakeLists.txt @@ -57,7 +57,7 @@ endif() # Support plugins. if(CLANG_PLUGIN_SUPPORT) - export_executable_symbols(clang) + export_executable_symbols_for_plugins(clang) endif() add_dependencies(clang clang-resource-headers) diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index 7b95d8be1b60..8cd71eef2332 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -1029,6 +1029,13 @@ function(export_executable_symbols target) endif() endfunction() +# Export symbols if LLVM plugins are enabled. +function(export_executable_symbols_for_plugins target) + if(LLVM_ENABLE_PLUGINS) + export_executable_symbols(${target}) + endif() +endfunction() + if(NOT LLVM_TOOLCHAIN_TOOLS) set (LLVM_TOOLCHAIN_TOOLS llvm-ar diff --git a/llvm/tools/bugpoint/CMakeLists.txt b/llvm/tools/bugpoint/CMakeLists.txt index 0b5998e181eb..8d2d5a06e664 100644 --- a/llvm/tools/bugpoint/CMakeLists.txt +++ b/llvm/tools/bugpoint/CMakeLists.txt @@ -38,4 +38,4 @@ add_llvm_tool(bugpoint intrinsics_gen SUPPORT_PLUGINS ) -export_executable_symbols(bugpoint) +export_executable_symbols_for_plugins(bugpoint) diff --git a/llvm/tools/llc/CMakeLists.txt b/llvm/tools/llc/CMakeLists.txt index 479bc6b55b27..2eecfca2e075 100644 --- a/llvm/tools/llc/CMakeLists.txt +++ b/llvm/tools/llc/CMakeLists.txt @@ -27,4 +27,4 @@ add_llvm_tool(llc SUPPORT_PLUGINS ) -export_executable_symbols(llc) +export_executable_symbols_for_plugins(llc) diff --git a/llvm/tools/llvm-stress/CMakeLists.txt b/llvm/tools/llvm-stress/CMakeLists.txt index 139ab9e0d8f9..e4d1ae65ee76 100644 --- a/llvm/tools/llvm-stress/CMakeLists.txt +++ b/llvm/tools/llvm-stress/CMakeLists.txt @@ -10,4 +10,3 @@ add_llvm_tool(llvm-stress DEPENDS intrinsics_gen ) -export_executable_symbols(llvm-stress) diff --git a/llvm/tools/opt/CMakeLists.txt b/llvm/tools/opt/CMakeLists.txt index 79613c836c53..8caa1b78b729 100644 --- a/llvm/tools/opt/CMakeLists.txt +++ b/llvm/tools/opt/CMakeLists.txt @@ -39,7 +39,7 @@ add_llvm_tool(opt intrinsics_gen SUPPORT_PLUGINS ) -export_executable_symbols(opt) +export_executable_symbols_for_plugins(opt) if(LLVM_BUILD_EXAMPLES) target_link_libraries(opt PRIVATE ExampleIRTransforms) diff --git a/llvm/unittests/Passes/CMakeLists.txt b/llvm/unittests/Passes/CMakeLists.txt index c04aa9f84458..823bc56851fa 100644 --- a/llvm/unittests/Passes/CMakeLists.txt +++ b/llvm/unittests/Passes/CMakeLists.txt @@ -16,7 +16,7 @@ if (NOT WIN32) add_llvm_unittest(PluginsTests PluginsTest.cpp ) - export_executable_symbols(PluginsTests) + export_executable_symbols_for_plugins(PluginsTests) target_link_libraries(PluginsTests PRIVATE LLVMTestingSupport) set(LLVM_LINK_COMPONENTS) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits