Skip to content

Commit a9604cd

Browse files
[CMake] Fix DynamicLibraryTests exports symbol when plugins are enabled (#102941)
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.
1 parent 80c51fa commit a9604cd

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ macro(add_llvm_executable name)
10711071

10721072
if (DEFINED LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES AND
10731073
NOT LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES AND
1074-
NOT ARG_EXPORT_SYMBOLS AND NOT ARG_EXPORT_SYMBOLS_FOR_PLUGINS)
1074+
NOT ARG_EXPORT_SYMBOLS)
10751075
if(LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS)
10761076
set_property(TARGET ${name} APPEND_STRING PROPERTY
10771077
LINK_FLAGS " -Wl,-no_exported_symbols")

llvm/unittests/Support/DynamicLibrary/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@ set_output_directory(DynamicLibraryLib
1515
LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}
1616
)
1717

18+
set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/DynamicLibraryTests.exports)
19+
1820
add_llvm_unittest(DynamicLibraryTests
1921
DynamicLibraryTest.cpp
2022

2123
EXPORT_SYMBOLS
2224
)
2325
target_link_libraries(DynamicLibraryTests PRIVATE DynamicLibraryLib)
2426

27+
unset(LLVM_EXPORTED_SYMBOL_FILE)
28+
2529
function(dynlib_add_module NAME)
2630
add_library(${NAME} MODULE
2731
PipSqueak.cpp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TestA

0 commit comments

Comments
 (0)