[Interpreter] Fall back to loading Swift dylibs from /usr/lib/swift on Apple platforms.

Continue to load the dylibs next to the compiler if they exist. If they don't, then use the OS's dylibs.

rdar://problem/47528005
This commit is contained in:
Mike Ash
2019-05-16 14:41:25 -04:00
parent 379b7ad245
commit 3f774094b7
7 changed files with 53 additions and 14 deletions

View File

@@ -30,6 +30,11 @@
using namespace swift;
using namespace llvm::opt;
#if defined(__APPLE__) && defined(__MACH__)
/// The path for Swift libraries in the OS.
#define OS_LIBRARY_PATH "/usr/lib/swift"
#endif
swift::CompilerInvocation::CompilerInvocation() {
setTargetTriple(llvm::sys::getDefaultTargetTriple());
}
@@ -66,7 +71,11 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
llvm::SmallString<128> LibPath(SearchPathOpts.RuntimeResourcePath);
llvm::sys::path::append(LibPath, getPlatformNameForTriple(Triple));
SearchPathOpts.RuntimeLibraryPath = LibPath.str();
SearchPathOpts.RuntimeLibraryPaths.clear();
SearchPathOpts.RuntimeLibraryPaths.push_back(LibPath.str());
#if defined(__APPLE__) && defined(__MACH__)
SearchPathOpts.RuntimeLibraryPaths.push_back(OS_LIBRARY_PATH);
#endif
// Set up the import paths containing the swiftmodules for the libraries in
// RuntimeLibraryPath.