[llvm] [CMake] Fix DynamicLibraryTests exports symbol when plugins are enabled (PR #102941)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 10:42:28 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-support
Author: Steven Wu (cachemeifyoucan)
<details>
<summary>Changes</summary>
Exporting symbols from tools directory never worked with
`LLVM_EXPORT_SYMBOLS_FOR_PLUGINS=On`. When that options is on, only
symbols from the static library is linked is exported due to the export
symbols computation script. DynamicLibraryTests needs to export a symbol
from the tools/executable directory, so update it to use export list
instead.
---
Full diff: https://github.com/llvm/llvm-project/pull/102941.diff
3 Files Affected:
- (modified) llvm/cmake/modules/AddLLVM.cmake (+1-1)
- (modified) llvm/unittests/Support/DynamicLibrary/CMakeLists.txt (+1-1)
- (added) llvm/unittests/Support/DynamicLibrary/DynamicLibraryTests.exports (+1)
``````````diff
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 3e7e3a965559af..99959ecfae9cba 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1071,7 +1071,7 @@ macro(add_llvm_executable name)
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 ARG_EXPORT_SYMBOLS)
if(LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS)
set_property(TARGET ${name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-no_exported_symbols")
diff --git a/llvm/unittests/Support/DynamicLibrary/CMakeLists.txt b/llvm/unittests/Support/DynamicLibrary/CMakeLists.txt
index d8dff1ef4a3f77..e3b44a219edfb7 100644
--- a/llvm/unittests/Support/DynamicLibrary/CMakeLists.txt
+++ b/llvm/unittests/Support/DynamicLibrary/CMakeLists.txt
@@ -18,9 +18,9 @@ set_output_directory(DynamicLibraryLib
add_llvm_unittest(DynamicLibraryTests
DynamicLibraryTest.cpp
- EXPORT_SYMBOLS
)
target_link_libraries(DynamicLibraryTests PRIVATE DynamicLibraryLib)
+set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/DynamicLibraryTests.exports)
function(dynlib_add_module NAME)
add_library(${NAME} MODULE
diff --git a/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTests.exports b/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTests.exports
new file mode 100644
index 00000000000000..a9122211071ee6
--- /dev/null
+++ b/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTests.exports
@@ -0,0 +1 @@
+TestA
``````````
</details>
https://github.com/llvm/llvm-project/pull/102941
More information about the llvm-commits
mailing list