Load runtime library modules from SDK

With this change, swiftc will still look for standard library and overlay modules in ../lib/swift (relative to the compiler), but if it doesn’t find them there, it will now look in usr/lib/swift in the SDK.
This commit is contained in:
Brent Royal-Gordon
2019-03-07 18:50:40 -08:00
parent 46ddb2a607
commit c177674855
3 changed files with 56 additions and 0 deletions

View File

@@ -49,6 +49,8 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
llvm::sys::path::append(LibPath, getPlatformNameForTriple(Triple));
SearchPathOpts.RuntimeLibraryPath = LibPath.str();
// Set up the import paths containing the swiftmodules for the libraries in
// RuntimeLibraryPath.
SearchPathOpts.RuntimeLibraryImportPaths.clear();
// If this is set, we don't want any runtime import paths.
@@ -58,6 +60,12 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
if (!Triple.isOSDarwin())
llvm::sys::path::append(LibPath, swift::getMajorArchitectureName(Triple));
SearchPathOpts.RuntimeLibraryImportPaths.push_back(LibPath.str());
if (!SearchPathOpts.SDKPath.empty()) {
LibPath = SearchPathOpts.SDKPath;
llvm::sys::path::append(LibPath, "usr", "lib", "swift");
SearchPathOpts.RuntimeLibraryImportPaths.push_back(LibPath.str());
}
}
void CompilerInvocation::setRuntimeResourcePath(StringRef Path) {