-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Macros/Tests] Build test plugins with the same compiler as the dylib #70213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Macros/Tests] Build test plugins with the same compiler as the dylib #70213
Conversation
Sanitizer ABI are apparently not stable. We need to build the executable with the same compiler as the linking dylib. rdar://119141141
This reverts commit 26122f6.
@swift-ci Please smoke test |
preset=asan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find!
@@ -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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also insert cmake-cxx-compiler
? Or not add it to the cfg, since it is otherwise unused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My vote goes to remove config.cmake_cxx_compiler = r'''@CMAKE_CXX_COMPILER@'''
, if it is not needed. Not a big deal if it stays there, in any case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the tests are already running, let me leave it as-is. 👍
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' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-target %host_triple
this doesn't seem to be necessary, but still.
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by fix. libStaticMirror
was just copy-pasted from somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes of %cmake-c-compiler
are enough to remove the problems in those tests in my copy. The rest of the changes are good cleanups, so no problem in having them in the PR.
@@ -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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My vote goes to remove config.cmake_cxx_compiler = r'''@CMAKE_CXX_COMPILER@'''
, if it is not needed. Not a big deal if it stays there, in any case.
@swift-ci Please smoke test Windows |
1 similar comment
@swift-ci Please smoke test Windows |
Sanitizer ABI are apparently not stable. We need to build the executable with the same compiler as the linking dylib.
rdar://119141141