summaryrefslogtreecommitdiffstats
path: root/lib/Driver/ToolChains.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-01-25 08:10:33 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-01-25 08:10:33 +0000
commitea0428523b38298da44cdb894c481efa71fd4a56 (patch)
treec4d63e10aa352e32460d6576d1bc86f95df2f12d /lib/Driver/ToolChains.cpp
parent6f75cc3365da11c3677d961bbb11d1e86e3d2fc2 (diff)
Have FreeBSD use even more of the same smarts as Linux is now using for
adding search paths. Add them only when they exist, and prefix the paths with the sysroot. This will allow targeting a FreeBSD sysroot on a non-FreeBSD host machine, and perhaps more importantly should allow testing the FreeBSD driver's behavior similarly to the Linux tests with a fake tree of files in the regression test suite. I don't have FreeBSD systems handy to build up the list of files that should be used here, but this is the basic functionality and I'm hoping Roman or someone from the community can contribute the actual test cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148940 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains.cpp')
-rw-r--r--lib/Driver/ToolChains.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 6b8168e686..e50ab75494 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -1623,6 +1623,10 @@ Tool &OpenBSD::SelectTool(const Compilation &C, const JobAction &JA,
return *T;
}
+static void addPathIfExists(Twine Path, ToolChain::path_list &Paths) {
+ if (llvm::sys::fs::exists(Path)) Paths.push_back(Path.str());
+}
+
/// FreeBSD - FreeBSD tool chain which can call as(1) and ld(1) directly.
FreeBSD::FreeBSD(const HostInfo &Host, const llvm::Triple& Triple)
@@ -1633,9 +1637,9 @@ FreeBSD::FreeBSD(const HostInfo &Host, const llvm::Triple& Triple)
// for the remaining cases.
if (Triple.getArch() == llvm::Triple::x86 ||
Triple.getArch() == llvm::Triple::ppc)
- getFilePaths().push_back("/usr/lib32");
+ addPathIfExists(getDriver().SysRoot + "/usr/lib32", getFilePaths());
- getFilePaths().push_back("/usr/lib");
+ addPathIfExists(getDriver().SysRoot + "/usr/lib", getFilePaths());
}
Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA,
@@ -1929,10 +1933,6 @@ static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) {
return UnknownDistro;
}
-static void addPathIfExists(Twine Path, ToolChain::path_list &Paths) {
- if (llvm::sys::fs::exists(Path)) Paths.push_back(Path.str());
-}
-
/// \brief Get our best guess at the multiarch triple for a target.
///
/// Debian-based systems are starting to use a multiarch setup where they use