@@ -67,13 +67,20 @@ static enum sdk_test isAppAtLeastFall2023() {
67
67
const dyld_build_version_t fall_2023_os_versions = {0xffffffff , 0x007e70901 };
68
68
return isAppAtLeast (fall_2023_os_versions);
69
69
}
70
+
71
+ static enum sdk_test isAppAtLeastFall2024 () {
72
+ const dyld_build_version_t fall_2024_os_versions = {0xffffffff , 0x007e80000 };
73
+ return isAppAtLeast (fall_2024_os_versions);
74
+ }
70
75
#endif
71
76
72
77
static _SwiftStdlibVersion binCompatVersionOverride = { 0 };
73
78
74
79
static _SwiftStdlibVersion const knownVersions[] = {
75
80
{ /* 5.6.0 */ 0x050600 },
76
81
{ /* 5.7.0 */ 0x050700 },
82
+ // Note: If you add a new entry here, also add it to versionMap in
83
+ // _swift_stdlib_isExecutableLinkedOnOrAfter below.
77
84
{ 0 },
78
85
};
79
86
@@ -111,9 +118,27 @@ extern "C" __swift_bool _swift_stdlib_isExecutableLinkedOnOrAfter(
111
118
}
112
119
113
120
#if BINARY_COMPATIBILITY_APPLE
114
- // Return true for all known versions for now -- we can't map them to OS
115
- // versions at this time.
116
- return isKnownBinCompatVersion (version);
121
+ typedef struct {
122
+ _SwiftStdlibVersion stdlib;
123
+ dyld_build_version_t dyld;
124
+ } stdlib_version_map;
125
+
126
+ const dyld_build_version_t spring_2022_os_versions = {0xffffffff , 0x007e60301 };
127
+ const dyld_build_version_t fall_2022_os_versions = {0xffffffff , 0x007e60901 };
128
+
129
+ static stdlib_version_map const versionMap[] = {
130
+ { { /* 5.6.0 */ 0x050600 }, spring_2022_os_versions },
131
+ { { /* 5.7.0 */ 0x050700 }, fall_2022_os_versions },
132
+ // Note: if you add a new entry here, also add it to knownVersions above.
133
+ { { 0 }, { 0 , 0 } },
134
+ };
135
+
136
+ for (uint32_t i = 0 ; versionMap[i].stdlib ._value != 0 ; ++i) {
137
+ if (versionMap[i].stdlib ._value == version._value ) {
138
+ return isAppAtLeast (versionMap[i].dyld ) == newApp;
139
+ }
140
+ }
141
+ return false ;
117
142
118
143
#else // !BINARY_COMPATIBILITY_APPLE
119
144
return isKnownBinCompatVersion (version);
@@ -247,9 +272,11 @@ bool useLegacySwiftValueUnboxingInCasting() {
247
272
//
248
273
bool useLegacySwiftObjCHashing () {
249
274
#if BINARY_COMPATIBILITY_APPLE
250
- return true ; // For now, legacy behavior on Apple OSes
251
- #elif SWIFT_TARGET_OS_DARWIN
252
- return true ; // For now, use legacy behavior on open-source builds for Apple platforms
275
+ switch (isAppAtLeastFall2024 ()) {
276
+ case oldOS: return true ; // Legacy behavior on old OS
277
+ case oldApp: return true ; // Legacy behavior for old apps
278
+ case newApp: return false ; // New behavior for new apps
279
+ }
253
280
#else
254
281
return false ; // Always use the new behavior on non-Apple OSes
255
282
#endif
@@ -268,12 +295,13 @@ bool useLegacySwiftObjCHashing() {
268
295
// * This allows the method to invoke 'SerialExecutor/checkIsolated'
269
296
// * Which is allowed to call 'dispatch_precondition' and handle "on dispatch queue but not on Swift executor" cases
270
297
//
271
- // FIXME(concurrency): Once the release is announced, adjust the logic detecting the SDKs
272
298
bool swift_bincompat_useLegacyNonCrashingExecutorChecks () {
273
299
#if BINARY_COMPATIBILITY_APPLE
274
- return true ; // For now, legacy behavior on Apple OSes
275
- #elif SWIFT_TARGET_OS_DARWIN
276
- return true ; // For now, use legacy behavior on open-source builds for Apple platforms
300
+ switch (isAppAtLeastFall2024 ()) {
301
+ case oldOS: return true ; // Legacy behavior on old OS
302
+ case oldApp: return true ; // Legacy behavior for old apps
303
+ case newApp: return false ; // New behavior for new apps
304
+ }
277
305
#else
278
306
return false ; // Always use the new behavior on non-Apple OSes
279
307
#endif
0 commit comments