File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,25 @@ bool swift::immediate::autolinkImportedModules(ModuleDecl *M,
201
201
202
202
M->collectLinkLibraries (addLinkLibrary);
203
203
204
+ // Workaround for rdar://94645534.
205
+ //
206
+ // The framework layout of Foundation has changed in 13.0, causing unresolved symbol
207
+ // errors to libswiftFoundation in immediate mode when running on older OS versions
208
+ // with a 13.0 SDK. This workaround scans through the list of dependencies and
209
+ // manually adds libswiftFoundation if necessary.
210
+ auto &Target = M->getASTContext ().LangOpts .Target ;
211
+ if (Target.isMacOSX () && Target.getOSMajorVersion () < 13 ) {
212
+ bool linksFoundation = std::any_of (AllLinkLibraries.begin (),
213
+ AllLinkLibraries.end (), [](auto &Lib) {
214
+ return Lib.getName () == " Foundation" ;
215
+ });
216
+
217
+ if (linksFoundation) {
218
+ AllLinkLibraries.push_back (LinkLibrary (" libswiftFoundation.dylib" ,
219
+ LibraryKind::Library));
220
+ }
221
+ }
222
+
204
223
tryLoadLibraries (AllLinkLibraries, M->getASTContext ().SearchPathOpts ,
205
224
M->getASTContext ().Diags );
206
225
return false ;
You can’t perform that action at this time.
0 commit comments