1Patch paths to use the separate 'lib' output. One of the things this patch
2fixes is the output of `swift -frontend -print-target-info`, which swiftpm uses
3to set rpath on Linux.
4
5The check if the executable path starts with 'out' is necessary for
6bootstrapping, or the compiler will fail when run from the build directory.
7
8--- a/lib/Frontend/CompilerInvocation.cpp
9+++ b/lib/Frontend/CompilerInvocation.cpp
10@@ -49,11 +49,16 @@ swift::CompilerInvocation::CompilerInvocation() {
11 void CompilerInvocation::computeRuntimeResourcePathFromExecutablePath(
12 StringRef mainExecutablePath, bool shared,
13 llvm::SmallVectorImpl<char> &runtimeResourcePath) {
14+ if (mainExecutablePath.startswith("@storeDir@")) {
15+ auto libPath = StringRef("@lib@");
16+ runtimeResourcePath.append(libPath.begin(), libPath.end());
17+ } else {
18 runtimeResourcePath.append(mainExecutablePath.begin(),
19 mainExecutablePath.end());
20
21 llvm::sys::path::remove_filename(runtimeResourcePath); // Remove /swift
22 llvm::sys::path::remove_filename(runtimeResourcePath); // Remove /bin
23+ }
24 appendSwiftLibDir(runtimeResourcePath, shared);
25 }
26