Fix some unit tests for LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES=Off.

Building with -DLLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES=Off should not
prevent the PluginsTests and DynamicLibraryTests unit tests from working.

This fix uses the approach implemented in
https://github.com/llvm/llvm-project/pull/101741.

rdar://135849875
This commit is contained in:
Lang Hames
2024-09-12 15:10:30 +10:00
parent d5f0969c96
commit 2e18f636fd
2 changed files with 4 additions and 2 deletions

View File

@@ -6,8 +6,9 @@ if (NOT WIN32 AND NOT CYGWIN)
set(LLVM_LINK_COMPONENTS Support Passes Core AsmParser)
add_llvm_unittest(PluginsTests
PluginsTest.cpp
EXPORT_SYMBOLS
)
export_executable_symbols_for_plugins(PluginsTests)
target_link_libraries(PluginsTests PRIVATE LLVMTestingSupport)
unset(LLVM_LINK_COMPONENTS)

View File

@@ -17,9 +17,10 @@ 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