[Macros/Tests] Build test plugins with the same compiler as the dylib

Sanitizer ABI are apparently not stable. We need to build the executable
with the same compiler as the linking dylib.

rdar://119141141
This commit is contained in:
Rintaro Ishizaki
2023-12-04 13:36:17 -08:00
parent a7a0b329f2
commit 90d3cf51e9
3 changed files with 5 additions and 2 deletions

View File

@@ -21,11 +21,12 @@ if get_target_os() in ['windows-msvc']:
else:
# FIXME(compnerd) do all the targets we currently support use SysV ABI?
config.substitutions.insert(0, ('%target-abi', 'SYSV'))
config.substitutions.insert(0, ('%cmake-c-compiler', config.cmake_c_compiler))
config.substitutions.insert(
0,
(
'%swift-build-c-plugin',
'%clang %c-flags %exe-linker-flags -isysroot %host_sdk -I %swift_src_root/include -L %swift-lib-dir -l_swiftMockPlugin -Xlinker -rpath -Xlinker %swift-lib-dir'
'%cmake-c-compiler %c-flags %exe-linker-flags -target %host_triple -isysroot %host_sdk -I %swift_src_root/include -L %swift-lib-dir -l_swiftMockPlugin -Xlinker -rpath -Xlinker %swift-lib-dir'
)
)
config.substitutions.append(('%c-flags', config.c_flags))

View File

@@ -44,6 +44,8 @@ config.swift_driver_test_options = "@SWIFT_DRIVER_TEST_OPTIONS@"
config.swift_frontend_test_options = "@SWIFT_FRONTEND_TEST_OPTIONS@"
config.swift_ide_test_test_options = "@SWIFT_IDE_TEST_TEST_OPTIONS@"
config.cmake_c_compiler = r'''@CMAKE_C_COMPILER@'''
config.cmake_cxx_compiler = r'''@CMAKE_CXX_COMPILER@'''
config.c_flags = r'''@CMAKE_C_FLAGS@'''
config.exe_linker_flags = r'''@CMAKE_EXE_LINKER_FLAGS@'''

View File

@@ -16,4 +16,4 @@ add_llvm_symbol_exports(libMockPlugin ${LLVM_EXPORTED_SYMBOL_FILE})
add_dependencies(tools libMockPlugin)
# Adds -dead_strip option
add_link_opts(libStaticMirror)
add_link_opts(libMockPlugin)