Skip to content

[Concurrency] Fix start of version ranges in install name magic symbols. #77980

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 1 commit into from
Dec 10, 2024

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Dec 5, 2024

The magic symbols specify a version range where clients should reference a @rpath relative path to libswift_Concurrency.dylib instead of the standard absolute path. This version range started at macOS 10.15 and aligned versions, which is the oldest target supported by Concurrency. However, clients that use Concurrency can target earlier OSes as long as they availability-check their use of Concurrency. When targeting something earlier than 10.15, they'd reference the absolute path, then fail to find the back-deployment Concurrency runtime on OS versions that need it.

Fix this by setting the start of the range to macOS 10.9 and aligned, which is the oldest target supported by Swift.

rdar://140476764

@ian-twilightcoder
Copy link
Contributor

Oh, yuck. I really wish that if a library has $ld$previous$ and you're trying to target something older then the linker would weak link the oldest $ld$previous$ instead.

@@ -34,6 +34,11 @@
// Xcode inserting a runpath search path of /usr/lib/swift based on the deployment target being less than
// SupportedTargets[target][SwiftConcurrencyMinimumDeploymentTarget] in SDKSettings.plist.

// Note: even though the embedded Concurrency library is only supported back to
Copy link
Contributor

Choose a reason for hiding this comment

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

// Clients can back deploy to OS versions that predate Concurrency as an embedded library, and conditionally use
// it behind an #availability check. Such clients will still need to link the embedded library instead of the OS version.
// To support that, set the start version to Swift's first supported versions: macOS (née OS X) 10.9, iOS 7.0,
// watchOS 2.0, tvOS 9.0 rather than Concurrency's first supported versions listed above.

RPATH_PREVIOUS_DIRECTIVE(PLATFORM_MACOS, 10.15, 12.0)
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_MACCATALYST, 13.1, 15.0)
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_MACOS, 10.9, 12.0)
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_MACCATALYST, 7.0, 15.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

The first version of Mac Catalyst was 13.1, so this one should stay the same.

#endif
#elif TARGET_OS_TV
#if TARGET_OS_SIMULATOR
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_TVOSSIMULATOR, 13.0, 15.0)
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_TVOSSIMULATOR, 2.0, 15.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be 9.0, the first version of tvOS.

#else
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_TVOS, 13.0, 15.0)
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_TVOS, 2.0, 15.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

9.0

@mikeash mikeash force-pushed the concurrency-magic-version-fix branch from 8bc6c05 to 67eab53 Compare December 6, 2024 21:36
@@ -34,6 +34,11 @@
// Xcode inserting a runpath search path of /usr/lib/swift based on the deployment target being less than
// SupportedTargets[target][SwiftConcurrencyMinimumDeploymentTarget] in SDKSettings.plist.

// Clients can back deploy to OS versions that predate Concurrency as an embedded library, and conditionally use
// it behind an #availability check. Such clients will still need to link the embedded library instead of the OS version.
Copy link
Contributor

Choose a reason for hiding this comment

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

Mega nitpick: I should've typed this out in the actual header. Can you try to make the right margin roughly line up with the previous paragraph? My lines were just a little too long.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@mikeash mikeash force-pushed the concurrency-magic-version-fix branch from 67eab53 to 82522a8 Compare December 6, 2024 21:40
@mikeash
Copy link
Contributor Author

mikeash commented Dec 6, 2024

@swift-ci please smoke test

@mikeash mikeash enabled auto-merge December 6, 2024 21:48
@mikeash
Copy link
Contributor Author

mikeash commented Dec 9, 2024

Infrastructure issue and unrelated test failure, trying again.

@mikeash
Copy link
Contributor Author

mikeash commented Dec 9, 2024

@swift-ci please smoke test

The magic symbols specify a version range where clients should reference a @rpath relative path to libswift_Concurrency.dylib instead of the standard absolute path. This version range started at macOS 10.15 and aligned versions, which is the oldest target supported by Concurrency. However, clients that use Concurrency can target earlier OSes as long as they availability-check their use of Concurrency. When targeting something earlier than 10.15, they'd reference the absolute path, then fail to find the back-deployment Concurrency runtime on OS versions that need it.

Fix this by setting the start of the range to macOS 10.9 and aligned, which is the oldest target supported by Swift.

rdar://140476764
@mikeash mikeash force-pushed the concurrency-magic-version-fix branch from 82522a8 to e727252 Compare December 9, 2024 20:57
@mikeash mikeash requested a review from a team as a code owner December 9, 2024 20:57
@mikeash
Copy link
Contributor Author

mikeash commented Dec 9, 2024

These symbols show up in the baseline for the ABI tests, need to adjust them too.

@mikeash
Copy link
Contributor Author

mikeash commented Dec 9, 2024

@swift-ci please smoke test

@mikeash mikeash merged commit 991d01c into swiftlang:main Dec 10, 2024
3 checks passed
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