Skip to content

Adding the Backdeploy 5.6 compatibility library #60368

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 3 commits into from
Aug 8, 2022

Conversation

etcwilde
Copy link
Member

@etcwilde etcwilde commented Aug 2, 2022

This PR starts adding the stubs for the Swift 5.6 back deployment compatibility library.
At this time it adds the ability to set the -runtime-compatibility-version to 5.6 in order to link the compatibility library, and declares two symbols for the swift_task_future_wait and swift_task_future_wait_throwing function replacements.
These functions currently just forward the call to the original implementation.

I have checked that this library is actually used by running

build/Ninja-ReleaseAssert/swift-macosx-arm64/bin/swiftc \
    -runtime-compatibility-version 5.6 test.swift \
    -parse-as-library -sdk $(xcrun --show-sdk-path -sdk macosx) \
    -target arm64-apple-macos11.0

then inspecting and executing the resulting binary.

This patch gets everything to the point of building the library, but it
doesn't run yet since I have missing symbols.

Unlike previous compatibility libraries and the concurrency
compatibility library, I'm organizing the headers a bit more. This is
because we're merging the two libraries into one. They share some common
header names, and while I could rename them for namespacing purposes,
it's easier to just use a directory structure for this.

The `include/Runtime` and corresponding `Runtime/` directories are for
backdeployed changes to the stdlib itself.

The `include/Concurrency` and corresponding `Concurrency/` directories
are for backdeployed changes to the concurrency runtimes.
This patch removes the implementation implementations and just calls the
original symbol without the fixes. This allows the library to build and
for binaries to link against it without breaking anything with missing
symbols.
@etcwilde etcwilde requested a review from DougGregor August 2, 2022 23:26
@etcwilde
Copy link
Member Author

etcwilde commented Aug 2, 2022

@swift-ci please test

@etcwilde
Copy link
Member Author

etcwilde commented Aug 2, 2022

Also, if someone knows how to actually test these backdeploy libraries with anything beyond "it compiles, ship it", I'm all ears.

This patch updates the concurrency backdeployment test to handle the
inclusion of the Swift 5.6 compatibility library.

macOS12 will have the 5.6 library applied to it, so the
_swift_FORCE_LOAD_$_swiftCompatibility56 symbol is defined weakly.
@etcwilde
Copy link
Member Author

etcwilde commented Aug 4, 2022

@swift-ci please test

@etcwilde
Copy link
Member Author

etcwilde commented Aug 4, 2022

Updated the weak_linking.swift back deployment test to check for _swift_FORCE_LOAD_$_swiftCompatibilityConcurrency and _swift_FORCE_LOAD_$_swiftCompatibility56 when back-deploying to 10.15. It only checks for _swift_FORCE_LOAD_$_swiftCompatibility56 when back-deploying to macOS 12.0, and ensures that nothing is back-deployed for macOS 13.0.

@etcwilde etcwilde marked this pull request as ready for review August 6, 2022 00:16
Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. I'm sure the contents of the compatibility library will shift around a bit as we start implementing the compatibility fixes, but the structure, build model, and linking here all look 💯.

@etcwilde etcwilde merged commit a3941bf into swiftlang:main Aug 8, 2022
@etcwilde etcwilde deleted the ewilde/backdeploy56 branch August 8, 2022 17:42
etcwilde added a commit to etcwilde/swift that referenced this pull request Aug 9, 2022
…eploy56"

This reverts commit a3941bf, reversing
changes made to f496151.
etcwilde added a commit to etcwilde/swift that referenced this pull request Aug 9, 2022
…eploy56"

This reverts commit a3941bf, reversing
changes made to b39302a.
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.

2 participants