Skip to content

Commit 9c88cdd

Browse files
committed
[6.1][Concurrency] Fix start of version ranges in install name magic symbols.
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 (cherry picked from commit e727252)
1 parent 0cd27f0 commit 9c88cdd

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

stdlib/public/Concurrency/linker-support/magic-symbols-for-install-name.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
// Xcode inserting a runpath search path of /usr/lib/swift based on the deployment target being less than
3535
// SupportedTargets[target][SwiftConcurrencyMinimumDeploymentTarget] in SDKSettings.plist.
3636

37+
// Clients can back deploy to OS versions that predate Concurrency as an embedded library, and conditionally
38+
// use it behind an #availability check. Such clients will still need to link the embedded library instead
39+
// of the OS version. To support that, set the start version to Swift's first supported versions: macOS (née
40+
// OS X) 10.9, iOS 7.0, watchOS 2.0, tvOS 9.0 rather than Concurrency's first supported versions listed
41+
// above.
42+
3743
// The linker uses a specially formatted symbol to do the back deployment:
3844
// $ld$previous$<install-name>$<compatibility-version>$<platform>$<start-version>$<end-version>$<symbol-name>$
3945
// compatibility-version and symbol-name are left off to apply to all library versions and symbols.
@@ -49,25 +55,25 @@
4955
RPATH_PREVIOUS_DIRECTIVE_IMPL(SWIFT_TARGET_LIBRARY_NAME, platform, startVersion, endVersion)
5056

5157
#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
52-
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_MACOS, 10.15, 12.0)
58+
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_MACOS, 10.9, 12.0)
5359
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_MACCATALYST, 13.1, 15.0)
5460
#elif TARGET_OS_IOS && !TARGET_OS_VISION
5561
#if TARGET_OS_SIMULATOR
56-
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_IOSSIMULATOR, 13.0, 15.0)
62+
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_IOSSIMULATOR, 7.0, 15.0)
5763
#else
58-
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_IOS, 13.0, 15.0)
64+
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_IOS, 7.0, 15.0)
5965
#endif
6066
#elif TARGET_OS_WATCH
6167
#if TARGET_OS_SIMULATOR
62-
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_WATCHOSSIMULATOR, 6.0, 8.0)
68+
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_WATCHOSSIMULATOR, 2.0, 8.0)
6369
#else
64-
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_WATCHOS, 6.0, 8.0)
70+
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_WATCHOS, 2.0, 8.0)
6571
#endif
6672
#elif TARGET_OS_TV
6773
#if TARGET_OS_SIMULATOR
68-
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_TVOSSIMULATOR, 13.0, 15.0)
74+
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_TVOSSIMULATOR, 9.0, 15.0)
6975
#else
70-
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_TVOS, 13.0, 15.0)
76+
RPATH_PREVIOUS_DIRECTIVE(PLATFORM_TVOS, 9.0, 15.0)
7177
#endif
7278
#endif
7379
// Concurrency wasn't supported as an embedded library in any other OS, so no need to create back deployment

test/abi/Inputs/macOS/arm64/concurrency/baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$ld$previous$@rpath/libswift_Concurrency.dylib$$1$10.15$12.0$$
1+
$ld$previous$@rpath/libswift_Concurrency.dylib$$1$10.9$12.0$$
22
$ld$previous$@rpath/libswift_Concurrency.dylib$$6$13.1$15.0$$
33
_$s13AsyncIteratorSciTl
44
_$s7ElementScITl

test/abi/Inputs/macOS/arm64/concurrency/baseline-asserts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$ld$previous$@rpath/libswift_Concurrency.dylib$$1$10.15$12.0$$
1+
$ld$previous$@rpath/libswift_Concurrency.dylib$$1$10.9$12.0$$
22
$ld$previous$@rpath/libswift_Concurrency.dylib$$6$13.1$15.0$$
33
_$s13AsyncIteratorSciTl
44
_$s7ElementScITl

test/abi/Inputs/macOS/x86_64/concurrency/baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$ld$previous$@rpath/libswift_Concurrency.dylib$$1$10.15$12.0$$
1+
$ld$previous$@rpath/libswift_Concurrency.dylib$$1$10.9$12.0$$
22
$ld$previous$@rpath/libswift_Concurrency.dylib$$6$13.1$15.0$$
33
_$s13AsyncIteratorSciTl
44
_$s7ElementScITl

test/abi/Inputs/macOS/x86_64/concurrency/baseline-asserts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$ld$previous$@rpath/libswift_Concurrency.dylib$$1$10.15$12.0$$
1+
$ld$previous$@rpath/libswift_Concurrency.dylib$$1$10.9$12.0$$
22
$ld$previous$@rpath/libswift_Concurrency.dylib$$6$13.1$15.0$$
33
_$s13AsyncIteratorSciTl
44
_$s7ElementScITl

0 commit comments

Comments
 (0)