-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Extend freestanding to support targeting Darwin platforms #40202
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
Conversation
da1374d
to
6fff7df
Compare
@swift-ci please python lint |
preset=stdlib_S_standalone_minimal_macho_x86_64,build,test |
preset=stdlib_S_standalone_darwin_x86_64,build,test |
@@ -1685,6 +1685,7 @@ function(add_swift_target_library name) | |||
set(SWIFTLIB_TARGET_SDKS ${SWIFT_SDKS}) | |||
endif() | |||
list_replace(SWIFTLIB_TARGET_SDKS ALL_APPLE_PLATFORMS "${SWIFT_DARWIN_PLATFORMS}") | |||
list(REMOVE_DUPLICATES SWIFTLIB_TARGET_SDKS) |
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.
Why is this part of this change? Is this because adding the FREESTANDING
now results in duplicates?
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.
Yes -- in particular FREESTANDING
could be present in SWIFT_DARWIN_PLATFORMS
and as an explicit target when building the Darwin overlay (as a result of https://github.com/apple/swift/blob/78809726080ce61a4f73c013d542c91d5da35f2e/stdlib/public/Platform/CMakeLists.txt#L21)
I could have added the deduplication in the file above, but this seemed something that could happen in other instances as well.
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.
This needs a nice big comment here.
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.
@edymtt is it possible to instead of adding in this deduplication, add in an assert that we never have duplicates and change the other code?
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.
For now I addressed the issue in Platform/CMakeLists.txt (a8d57e2)
Adding the assert seems to require some changes to precondition_binary_op
which may require further discussion a bit outside of this PR -- if time allows I will tackle that in another PR.
Build failed |
test/lit.cfg
Outdated
@@ -1155,7 +1165,10 @@ if run_vendor == 'apple': | |||
'Running tests on %s version %s (%s)' % | |||
(sw_vers_name, sw_vers_vers, sw_vers_build)) | |||
|
|||
config.target_sdk_name = xcrun_sdk_name | |||
if "-freestanding" in config.variant_suffix and config.swift_freestanding_is_darwin: | |||
config.target_sdk_name = "freestanding" |
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.
Can you add a comment here explaining why you are doing this.
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.
Added a comment in bbde1af, also pulled the value from CMake in an attempt to show where that value comes from.
preset=stdlib_S_standalone_minimal_macho_x86_64,build,test |
Build failed |
This happens on main as well -- https://ci.swift.org/job/oss-swift-test-stdlib-with-toolchain-minimal/843/console |
preset=stdlib_S_standalone_darwin_x86_64,build,test |
* add an option to add freestanding to the Darwin platform, so that to get expected compile behaviours (e.g. setting the install name) * rework testing configuration to relax assumptions about freestanding * add a preset to test such configuration (at least for PR testing) Addresses rdar://85465396
Drop deduplication of such lists so to surface configuration errors earlier.
Add some more comments as well
c843efb
to
bbde1af
Compare
Also take the chance to rename a function for clarity
@swift-ci please python lint |
preset=stdlib_S_standalone_minimal_macho_x86_64,build,test |
Testing the minimal preset before testing the one introduced with this PR |
The minimal preset succeeded, https://ci.swift.org/job/swift-PR-stdlib-with-toolchain-osx-preset/71/ |
preset=stdlib_S_standalone_darwin_x86_64,build,test |
@swift-ci please smoke test |
@swift-ci please test Apple Silicon |
@swift-ci please build toolchain |
Linux Toolchain (Ubuntu 16.04) Install command |
macOS Toolchain Install command |
@@ -972,6 +980,8 @@ if run_vendor == 'apple': | |||
symlink_if_not_exists("clang", "clang") | |||
symlink_if_not_exists("shims", "shims") | |||
symlink_if_not_exists("freestanding", "macosx") | |||
if config.swift_freestanding_is_darwin: |
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.
Can you add a comment here explaining why we are doing this?
|
||
swift_execution_tests_extra_flags += ' -experimental-hermetic-seal-at-link -lto=llvm-full' | ||
if not config.swift_freestanding_is_darwin: |
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.
I think this is fine for now, but the hermetic seal at link thing feels like it should have its own feature option sort of thing.
But that being said, I think this is good incremental work. Maybe put in a TODO.
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.
LGTM. Can you maybe add some comments in a follow on commit.
Tackles feedback of the review of swiftlang#40202
to get expected compile behaviours (e.g. setting the install name)
Addresses rdar://85465396