Skip to content

[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

Merged
merged 2 commits into from
Dec 5, 2023

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Dec 4, 2023

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

rdar://119141141

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

rdar://119141141
@rintaro
Copy link
Member Author

rintaro commented Dec 4, 2023

@swift-ci Please smoke test

@rintaro
Copy link
Member Author

rintaro commented Dec 4, 2023

preset=asan
@swift-ci Please test with preset macOS platform

Copy link
Contributor

@bnbarham bnbarham left a 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))
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Member Author

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'
Copy link
Member Author

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)
Copy link
Member Author

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.

Copy link
Contributor

@drodriguez drodriguez left a 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))
Copy link
Contributor

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.

@rintaro
Copy link
Member Author

rintaro commented Dec 5, 2023

@swift-ci Please smoke test Windows

1 similar comment
@rintaro
Copy link
Member Author

rintaro commented Dec 5, 2023

@swift-ci Please smoke test Windows

@rintaro rintaro merged commit 55032ea into swiftlang:main Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants