[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
cyndyishida wrote: https://github.com/llvm/llvm-project/pull/138234 superseded this patch, closing this one out. https://github.com/llvm/llvm-project/pull/118543 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
https://github.com/cyndyishida closed https://github.com/llvm/llvm-project/pull/118543 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
@@ -150,3 +150,23 @@ clang::parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS,
StringRef SDKRootPath) {
return llvm::make_error("invalid SDKSettings.json",
llvm::inconvertibleErrorCode());
}
+
+// For certain platforms/environments almost all resources (e.g., headers) are
+// located in sub-directories, e.g., for DriverKit they live in
+// /System/DriverKit/usr/include (instead of /usr/include).
+StringRef clang::getSystemPrefix(const llvm::Triple &T) {
+ if (T.isDriverKit())
+return "/System/DriverKit";
+ return "";
+}
+
+KnownSystemPaths clang::getCommonSystemPaths(llvm::Triple T) {
cyndyishida wrote:
yeah, I was initially thinking any common paths between header & linker search
which in practice is only frameworks but could be extended in the future. That
feels unlikely though. I can apply your suggestion, assuming it's still
relevant, after rebasing your patch.
https://github.com/llvm/llvm-project/pull/118543
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
@@ -339,13 +340,11 @@ void InitHeaderSearch::AddDefaultIncludePaths(
if (triple.isOSDarwin()) {
ldionne wrote:
I'm trying to revive this as https://github.com/llvm/llvm-project/pull/120149
https://github.com/llvm/llvm-project/pull/118543
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
@@ -339,13 +340,11 @@ void InitHeaderSearch::AddDefaultIncludePaths(
if (triple.isOSDarwin()) {
ldionne wrote:
FWIW I agree with your assessment @cyndyishida. I just did the exercise of
picking up #75841 and we basically need to pass `-iframework` from the driver
to the frontend, but if we limit ourselves to existing functionality in the
driver that ends up putting the framework search paths before other system
headers. I think that should be attempted as a separate patch that tries
reviving #75841.
https://github.com/llvm/llvm-project/pull/118543
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
@@ -150,3 +150,23 @@ clang::parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS,
StringRef SDKRootPath) {
return llvm::make_error("invalid SDKSettings.json",
llvm::inconvertibleErrorCode());
}
+
+// For certain platforms/environments almost all resources (e.g., headers) are
+// located in sub-directories, e.g., for DriverKit they live in
+// /System/DriverKit/usr/include (instead of /usr/include).
+StringRef clang::getSystemPrefix(const llvm::Triple &T) {
+ if (T.isDriverKit())
+return "/System/DriverKit";
+ return "";
+}
+
+KnownSystemPaths clang::getCommonSystemPaths(llvm::Triple T) {
ldionne wrote:
I feel like this function might be slightly misnamed, unless I don't properly
understand its purpose. `getCommonSystemPaths` is a very general name, but in
reality this seems to only return the framework paths. As currently named, this
makes it seem as though we could potentially return header paths, library
paths, framework paths, etc.
If this will only ever return framework paths, perhaps a name like
`getCommonSystemFrameworkPaths` would be better?
https://github.com/llvm/llvm-project/pull/118543
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
@@ -339,13 +340,11 @@ void InitHeaderSearch::AddDefaultIncludePaths(
if (triple.isOSDarwin()) {
cyndyishida wrote:
I looked into this a bit more. IMO the only way to move all this code to the
driver is to either
1. changing search path order between Framework search paths & other default
search paths like `-internal-isystem $(SDKROOT)/usr/include` (since existing
`iframework` puts the search path at the top instead of at the bottom like what
`InitHeaderSearch` does)
OR
2. introducing some kind of search path argument to preserve back precedence
for S/L/F e.g. a `-internal-iframework`
Both feel out of scope to me.
https://github.com/llvm/llvm-project/pull/118543
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
https://github.com/cyndyishida edited https://github.com/llvm/llvm-project/pull/118543 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
@@ -339,13 +340,11 @@ void InitHeaderSearch::AddDefaultIncludePaths(
if (triple.isOSDarwin()) {
cyndyishida wrote:
Looks like that was previously attempted by @ldionne in
https://github.com/llvm/llvm-project/pull/75841
The problem was appending `/Library/Frameworks` to the sysroot. I'll try
rebasing that.
https://github.com/llvm/llvm-project/pull/118543
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
@@ -192,6 +192,17 @@ class DarwinSDKInfo {
Expected>
parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS, StringRef SDKRootPath);
+/// Get the system platform prefix for the active target triple.
cachemeifyoucan wrote:
I feel this header is used for parsing `SDKSettings.json` only. I don't feel
like these functions are in the correct place.
If we can do the cleanup for where my other comment is, we can just limit these
function to be local to `Driver/Toolchains/Darwin.cpp`. No other file needs to
have this information.
https://github.com/llvm/llvm-project/pull/118543
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
@@ -339,13 +340,11 @@ void InitHeaderSearch::AddDefaultIncludePaths(
if (triple.isOSDarwin()) {
cachemeifyoucan wrote:
Do you think we can just clean up this code block by moving all logics to
driver?
https://github.com/llvm/llvm-project/pull/118543
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
https://github.com/cachemeifyoucan edited https://github.com/llvm/llvm-project/pull/118543 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
https://github.com/cachemeifyoucan commented: Some comments in line. https://github.com/llvm/llvm-project/pull/118543 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
llvmbot wrote:
@llvm/pr-subscribers-clang-driver
Author: Cyndy Ishida (cyndyishida)
Changes
* Use the centralized API to add `SubFrameworks` for driverkit targets.
---
Full diff: https://github.com/llvm/llvm-project/pull/118543.diff
5 Files Affected:
- (modified) clang/include/clang/Basic/DarwinSDKInfo.h (+12-1)
- (modified) clang/lib/Basic/DarwinSDKInfo.cpp (+20)
- (modified) clang/lib/Driver/ToolChains/Darwin.cpp (+11-16)
- (modified) clang/lib/Lex/InitHeaderSearch.cpp (+5-6)
- (modified) clang/test/Driver/driverkit-path.c (+3)
``diff
diff --git a/clang/include/clang/Basic/DarwinSDKInfo.h
b/clang/include/clang/Basic/DarwinSDKInfo.h
index db20b968a898ea..87c0a2abb2432c 100644
--- a/clang/include/clang/Basic/DarwinSDKInfo.h
+++ b/clang/include/clang/Basic/DarwinSDKInfo.h
@@ -1,4 +1,4 @@
-//===--- DarwinSDKInfo.h - SDK Information parser for darwin *- C++
-*-===//
+//===--- DarwinSDKInfo.h - SDK Information for darwin ---*- C++
-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -192,6 +192,17 @@ class DarwinSDKInfo {
Expected>
parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS, StringRef SDKRootPath);
+/// Get the system platform prefix for the active target triple.
+StringRef getSystemPrefix(const llvm::Triple &T);
+
+using KnownSystemPaths = std::array;
+
+/// Compute and get the common system search paths for header frontend and
+/// library linker searching.
+///
+/// \param T The active target triple to determine platform specific paths.
+KnownSystemPaths getCommonSystemPaths(llvm::Triple T);
+
} // end namespace clang
#endif // LLVM_CLANG_BASIC_DARWINSDKINFO_H
diff --git a/clang/lib/Basic/DarwinSDKInfo.cpp
b/clang/lib/Basic/DarwinSDKInfo.cpp
index 00aa5f9e63cd3f..914ce0a554008a 100644
--- a/clang/lib/Basic/DarwinSDKInfo.cpp
+++ b/clang/lib/Basic/DarwinSDKInfo.cpp
@@ -150,3 +150,23 @@ clang::parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS,
StringRef SDKRootPath) {
return llvm::make_error("invalid SDKSettings.json",
llvm::inconvertibleErrorCode());
}
+
+// For certain platforms/environments almost all resources (e.g., headers) are
+// located in sub-directories, e.g., for DriverKit they live in
+// /System/DriverKit/usr/include (instead of /usr/include).
+StringRef clang::getSystemPrefix(const llvm::Triple &T) {
+ if (T.isDriverKit())
+return "/System/DriverKit";
+ return "";
+}
+
+KnownSystemPaths clang::getCommonSystemPaths(llvm::Triple T) {
+ KnownSystemPaths CommonSysPaths = {"/System/Library/Frameworks",
+ "/System/Library/SubFrameworks"};
+
+ const StringRef Prefix = getSystemPrefix(T);
+ for (std::string &SysPath : CommonSysPaths)
+SysPath = (Prefix + SysPath).str();
+
+ return CommonSysPaths;
+}
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp
b/clang/lib/Driver/ToolChains/Darwin.cpp
index 87380869f6fdab..cadfbcba9afaa6 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -11,6 +11,7 @@
#include "Arch/ARM.h"
#include "CommonArgs.h"
#include "clang/Basic/AlignedAllocation.h"
+#include "clang/Basic/DarwinSDKInfo.h"
#include "clang/Basic/ObjCRuntime.h"
#include "clang/Config/config.h"
#include "clang/Driver/Compilation.h"
@@ -564,8 +565,6 @@ static void renderRemarksOptions(const ArgList &Args,
ArgStringList &CmdArgs,
}
}
-static void AppendPlatformPrefix(SmallString<128> &Path, const llvm::Triple
&T);
-
void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
@@ -811,16 +810,22 @@ void darwin::Linker::ConstructJob(Compilation &C, const
JobAction &JA,
if (NonStandardSearchPath) {
if (auto *Sysroot = Args.getLastArg(options::OPT_isysroot)) {
-auto AddSearchPath = [&](StringRef Flag, StringRef SearchPath) {
+auto AddSearchPath = [&](StringRef Flag, StringRef SearchPath,
+ bool HasPrefix = false) {
SmallString<128> P(Sysroot->getValue());
- AppendPlatformPrefix(P, Triple);
+ if (!HasPrefix)
+P.append(getSystemPrefix(Triple));
llvm::sys::path::append(P, SearchPath);
if (getToolChain().getVFS().exists(P)) {
CmdArgs.push_back(Args.MakeArgString(Flag + P));
}
};
+
AddSearchPath("-L", "/usr/lib");
-AddSearchPath("-F", "/System/Library/Frameworks");
+for (const StringRef Path : getCommonSystemPaths(Triple)) {
+ if (Path.contains("Framework"))
+AddSearchPath("-F", Path, /*HasPrefix=*/true);
+}
}
}
}
@@ -2463,16 +2468,6 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args)
const {
}
}
-// For certain platforms/environments
[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Cyndy Ishida (cyndyishida)
Changes
* Use the centralized API to add `SubFrameworks` for driverkit targets.
---
Full diff: https://github.com/llvm/llvm-project/pull/118543.diff
5 Files Affected:
- (modified) clang/include/clang/Basic/DarwinSDKInfo.h (+12-1)
- (modified) clang/lib/Basic/DarwinSDKInfo.cpp (+20)
- (modified) clang/lib/Driver/ToolChains/Darwin.cpp (+11-16)
- (modified) clang/lib/Lex/InitHeaderSearch.cpp (+5-6)
- (modified) clang/test/Driver/driverkit-path.c (+3)
``diff
diff --git a/clang/include/clang/Basic/DarwinSDKInfo.h
b/clang/include/clang/Basic/DarwinSDKInfo.h
index db20b968a898ea..87c0a2abb2432c 100644
--- a/clang/include/clang/Basic/DarwinSDKInfo.h
+++ b/clang/include/clang/Basic/DarwinSDKInfo.h
@@ -1,4 +1,4 @@
-//===--- DarwinSDKInfo.h - SDK Information parser for darwin *- C++
-*-===//
+//===--- DarwinSDKInfo.h - SDK Information for darwin ---*- C++
-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -192,6 +192,17 @@ class DarwinSDKInfo {
Expected>
parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS, StringRef SDKRootPath);
+/// Get the system platform prefix for the active target triple.
+StringRef getSystemPrefix(const llvm::Triple &T);
+
+using KnownSystemPaths = std::array;
+
+/// Compute and get the common system search paths for header frontend and
+/// library linker searching.
+///
+/// \param T The active target triple to determine platform specific paths.
+KnownSystemPaths getCommonSystemPaths(llvm::Triple T);
+
} // end namespace clang
#endif // LLVM_CLANG_BASIC_DARWINSDKINFO_H
diff --git a/clang/lib/Basic/DarwinSDKInfo.cpp
b/clang/lib/Basic/DarwinSDKInfo.cpp
index 00aa5f9e63cd3f..914ce0a554008a 100644
--- a/clang/lib/Basic/DarwinSDKInfo.cpp
+++ b/clang/lib/Basic/DarwinSDKInfo.cpp
@@ -150,3 +150,23 @@ clang::parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS,
StringRef SDKRootPath) {
return llvm::make_error("invalid SDKSettings.json",
llvm::inconvertibleErrorCode());
}
+
+// For certain platforms/environments almost all resources (e.g., headers) are
+// located in sub-directories, e.g., for DriverKit they live in
+// /System/DriverKit/usr/include (instead of /usr/include).
+StringRef clang::getSystemPrefix(const llvm::Triple &T) {
+ if (T.isDriverKit())
+return "/System/DriverKit";
+ return "";
+}
+
+KnownSystemPaths clang::getCommonSystemPaths(llvm::Triple T) {
+ KnownSystemPaths CommonSysPaths = {"/System/Library/Frameworks",
+ "/System/Library/SubFrameworks"};
+
+ const StringRef Prefix = getSystemPrefix(T);
+ for (std::string &SysPath : CommonSysPaths)
+SysPath = (Prefix + SysPath).str();
+
+ return CommonSysPaths;
+}
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp
b/clang/lib/Driver/ToolChains/Darwin.cpp
index 87380869f6fdab..cadfbcba9afaa6 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -11,6 +11,7 @@
#include "Arch/ARM.h"
#include "CommonArgs.h"
#include "clang/Basic/AlignedAllocation.h"
+#include "clang/Basic/DarwinSDKInfo.h"
#include "clang/Basic/ObjCRuntime.h"
#include "clang/Config/config.h"
#include "clang/Driver/Compilation.h"
@@ -564,8 +565,6 @@ static void renderRemarksOptions(const ArgList &Args,
ArgStringList &CmdArgs,
}
}
-static void AppendPlatformPrefix(SmallString<128> &Path, const llvm::Triple
&T);
-
void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
@@ -811,16 +810,22 @@ void darwin::Linker::ConstructJob(Compilation &C, const
JobAction &JA,
if (NonStandardSearchPath) {
if (auto *Sysroot = Args.getLastArg(options::OPT_isysroot)) {
-auto AddSearchPath = [&](StringRef Flag, StringRef SearchPath) {
+auto AddSearchPath = [&](StringRef Flag, StringRef SearchPath,
+ bool HasPrefix = false) {
SmallString<128> P(Sysroot->getValue());
- AppendPlatformPrefix(P, Triple);
+ if (!HasPrefix)
+P.append(getSystemPrefix(Triple));
llvm::sys::path::append(P, SearchPath);
if (getToolChain().getVFS().exists(P)) {
CmdArgs.push_back(Args.MakeArgString(Flag + P));
}
};
+
AddSearchPath("-L", "/usr/lib");
-AddSearchPath("-F", "/System/Library/Frameworks");
+for (const StringRef Path : getCommonSystemPaths(Triple)) {
+ if (Path.contains("Framework"))
+AddSearchPath("-F", Path, /*HasPrefix=*/true);
+}
}
}
}
@@ -2463,16 +2468,6 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args)
const {
}
}
-// For certain platforms/environments almost
[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)
https://github.com/cyndyishida created
https://github.com/llvm/llvm-project/pull/118543
* Use the centralized API to add `SubFrameworks` for driverkit targets.
>From 764bf57ac39fddef74d45d16fffc14035bbbff72 Mon Sep 17 00:00:00 2001
From: Cyndy Ishida
Date: Tue, 3 Dec 2024 11:15:37 -0800
Subject: [PATCH] [Clang][Darwin] Centralize framework search paths for headers
& libraries.
* Use the centralized API to add `SubFrameworks` for driverkit targets.
---
clang/include/clang/Basic/DarwinSDKInfo.h | 13 ++-
clang/lib/Basic/DarwinSDKInfo.cpp | 20 +
clang/lib/Driver/ToolChains/Darwin.cpp| 27 +--
clang/lib/Lex/InitHeaderSearch.cpp| 11 +
clang/test/Driver/driverkit-path.c| 3 +++
5 files changed, 51 insertions(+), 23 deletions(-)
diff --git a/clang/include/clang/Basic/DarwinSDKInfo.h
b/clang/include/clang/Basic/DarwinSDKInfo.h
index db20b968a898ea..87c0a2abb2432c 100644
--- a/clang/include/clang/Basic/DarwinSDKInfo.h
+++ b/clang/include/clang/Basic/DarwinSDKInfo.h
@@ -1,4 +1,4 @@
-//===--- DarwinSDKInfo.h - SDK Information parser for darwin *- C++
-*-===//
+//===--- DarwinSDKInfo.h - SDK Information for darwin ---*- C++
-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -192,6 +192,17 @@ class DarwinSDKInfo {
Expected>
parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS, StringRef SDKRootPath);
+/// Get the system platform prefix for the active target triple.
+StringRef getSystemPrefix(const llvm::Triple &T);
+
+using KnownSystemPaths = std::array;
+
+/// Compute and get the common system search paths for header frontend and
+/// library linker searching.
+///
+/// \param T The active target triple to determine platform specific paths.
+KnownSystemPaths getCommonSystemPaths(llvm::Triple T);
+
} // end namespace clang
#endif // LLVM_CLANG_BASIC_DARWINSDKINFO_H
diff --git a/clang/lib/Basic/DarwinSDKInfo.cpp
b/clang/lib/Basic/DarwinSDKInfo.cpp
index 00aa5f9e63cd3f..914ce0a554008a 100644
--- a/clang/lib/Basic/DarwinSDKInfo.cpp
+++ b/clang/lib/Basic/DarwinSDKInfo.cpp
@@ -150,3 +150,23 @@ clang::parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS,
StringRef SDKRootPath) {
return llvm::make_error("invalid SDKSettings.json",
llvm::inconvertibleErrorCode());
}
+
+// For certain platforms/environments almost all resources (e.g., headers) are
+// located in sub-directories, e.g., for DriverKit they live in
+// /System/DriverKit/usr/include (instead of /usr/include).
+StringRef clang::getSystemPrefix(const llvm::Triple &T) {
+ if (T.isDriverKit())
+return "/System/DriverKit";
+ return "";
+}
+
+KnownSystemPaths clang::getCommonSystemPaths(llvm::Triple T) {
+ KnownSystemPaths CommonSysPaths = {"/System/Library/Frameworks",
+ "/System/Library/SubFrameworks"};
+
+ const StringRef Prefix = getSystemPrefix(T);
+ for (std::string &SysPath : CommonSysPaths)
+SysPath = (Prefix + SysPath).str();
+
+ return CommonSysPaths;
+}
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp
b/clang/lib/Driver/ToolChains/Darwin.cpp
index 87380869f6fdab..cadfbcba9afaa6 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -11,6 +11,7 @@
#include "Arch/ARM.h"
#include "CommonArgs.h"
#include "clang/Basic/AlignedAllocation.h"
+#include "clang/Basic/DarwinSDKInfo.h"
#include "clang/Basic/ObjCRuntime.h"
#include "clang/Config/config.h"
#include "clang/Driver/Compilation.h"
@@ -564,8 +565,6 @@ static void renderRemarksOptions(const ArgList &Args,
ArgStringList &CmdArgs,
}
}
-static void AppendPlatformPrefix(SmallString<128> &Path, const llvm::Triple
&T);
-
void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
@@ -811,16 +810,22 @@ void darwin::Linker::ConstructJob(Compilation &C, const
JobAction &JA,
if (NonStandardSearchPath) {
if (auto *Sysroot = Args.getLastArg(options::OPT_isysroot)) {
-auto AddSearchPath = [&](StringRef Flag, StringRef SearchPath) {
+auto AddSearchPath = [&](StringRef Flag, StringRef SearchPath,
+ bool HasPrefix = false) {
SmallString<128> P(Sysroot->getValue());
- AppendPlatformPrefix(P, Triple);
+ if (!HasPrefix)
+P.append(getSystemPrefix(Triple));
llvm::sys::path::append(P, SearchPath);
if (getToolChain().getVFS().exists(P)) {
CmdArgs.push_back(Args.MakeArgString(Flag + P));
}
};
+
AddSearchPath("-L", "/usr/lib");
-AddSearchPath("-F", "/System/Library/Frameworks");
+for (const StringRef Path : getCommonSystemPaths(Triple)) {
+ if (Pat
