summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChains.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-01-25 11:24:24 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-01-25 11:24:24 +0000
commitf7bf3db070d476d590a5cbe7045ffe5dbd8ef701 (patch)
tree77ad38d6d216a9cf7d0b0327bb3275c827816292 /clang/lib/Driver/ToolChains.cpp
parent1ccbed88fc66398c3a8f2d6eec5d95fca8908e28 (diff)
downloadbcm5719-llvm-f7bf3db070d476d590a5cbe7045ffe5dbd8ef701.tar.gz
bcm5719-llvm-f7bf3db070d476d590a5cbe7045ffe5dbd8ef701.zip
The Linux pattern of adding all the search paths that exist doesn't seem
to suit the FreeBSD folks. Take them back to something closer to the old behavior. We test whether the /usr/lib32 directory exists (within the SysRoot), and use it if so, otherwise use /usr/lib. FreeBSD folks, let me know if this causes any problems, or if you have further tweaks. llvm-svn: 148953
Diffstat (limited to 'clang/lib/Driver/ToolChains.cpp')
-rw-r--r--clang/lib/Driver/ToolChains.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index 533e4f821cd..44f51e4c5d5 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -1622,23 +1622,19 @@ 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 Driver &D, const llvm::Triple& Triple)
: Generic_ELF(D, Triple) {
- // When targeting 32-bit platforms, look for libraries in '/usr/lib32' first;
- // for 64-bit hosts that's where they will live. We fall back to '/usr/lib'
- // for the remaining cases.
- if (Triple.getArch() == llvm::Triple::x86 ||
- Triple.getArch() == llvm::Triple::ppc)
- addPathIfExists(getDriver().SysRoot + "/usr/lib32", getFilePaths());
-
- addPathIfExists(getDriver().SysRoot + "/usr/lib", getFilePaths());
+ // When targeting 32-bit platforms, look for '/usr/lib32' first and fall back
+ // to '/usr/lib' for the remaining cases.
+ if ((Triple.getArch() == llvm::Triple::x86 ||
+ Triple.getArch() == llvm::Triple::ppc) &&
+ llvm::sys::fs::exists(getDriver().SysRoot + "/usr/lib32"))
+ getFilePaths().push_back(getDriver().SysRoot + "/usr/lib32");
+ else
+ getFilePaths().push_back(getDriver().SysRoot + "/usr/lib");
}
Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA,
@@ -1968,6 +1964,10 @@ static std::string getMultiarchTriple(const llvm::Triple TargetTriple,
}
}
+static void addPathIfExists(Twine Path, ToolChain::path_list &Paths) {
+ if (llvm::sys::fs::exists(Path)) Paths.push_back(Path.str());
+}
+
Linux::Linux(const Driver &D, const llvm::Triple &Triple)
: Generic_ELF(D, Triple) {
llvm::Triple::ArchType Arch = Triple.getArch();
OpenPOWER on IntegriCloud