aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Driver/Driver.cpp2
-rw-r--r--lib/Driver/ToolChains.cpp27
-rw-r--r--lib/Driver/ToolChains.h5
3 files changed, 15 insertions, 19 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 0f190c772e..6a4e0b3f75 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -1654,7 +1654,7 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
TC = new toolchains::OpenBSD(*this, Target);
break;
case llvm::Triple::NetBSD:
- TC = new toolchains::NetBSD(*this, Target, Target);
+ TC = new toolchains::NetBSD(*this, Target);
break;
case llvm::Triple::FreeBSD:
TC = new toolchains::FreeBSD(*this, Target);
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index fd364ef9e7..533e4f821c 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -1674,21 +1674,20 @@ Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA,
/// NetBSD - NetBSD tool chain which can call as(1) and ld(1) directly.
-NetBSD::NetBSD(const Driver &D, const llvm::Triple& Triple,
- const llvm::Triple& ToolTriple)
- : Generic_ELF(D, Triple), ToolTriple(ToolTriple) {
-
- // Determine if we are compiling 32-bit code on an x86_64 platform.
- bool Lib32 = false;
- if (ToolTriple.getArch() == llvm::Triple::x86_64 &&
- Triple.getArch() == llvm::Triple::x86)
- Lib32 = true;
+NetBSD::NetBSD(const Driver &D, const llvm::Triple& Triple)
+ : Generic_ELF(D, Triple) {
if (getDriver().UseStdLib) {
- if (Lib32)
+ // When targeting a 32-bit platform, try the special directory used on
+ // 64-bit hosts, and only fall back to the main library directory if that
+ // doesn't work.
+ // FIXME: It'd be nicer to test if this directory exists, but I'm not sure
+ // what all logic is needed to emulate the '=' prefix here.
+ if (Triple.getArch() == llvm::Triple::x86 ||
+ Triple.getArch() == llvm::Triple::ppc)
getFilePaths().push_back("=/usr/lib/i386");
- else
- getFilePaths().push_back("=/usr/lib");
+
+ getFilePaths().push_back("=/usr/lib");
}
}
@@ -1711,10 +1710,10 @@ Tool &NetBSD::SelectTool(const Compilation &C, const JobAction &JA,
if (UseIntegratedAs)
T = new tools::ClangAs(*this);
else
- T = new tools::netbsd::Assemble(*this, ToolTriple);
+ T = new tools::netbsd::Assemble(*this, getTriple());
break;
case Action::LinkJobClass:
- T = new tools::netbsd::Link(*this, ToolTriple);
+ T = new tools::netbsd::Link(*this, getTriple());
break;
default:
T = &Generic_GCC::SelectTool(C, JA, Inputs);
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
index be1d446c52..071a36774d 100644
--- a/lib/Driver/ToolChains.h
+++ b/lib/Driver/ToolChains.h
@@ -469,11 +469,8 @@ public:
};
class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF {
- const llvm::Triple ToolTriple;
-
public:
- NetBSD(const Driver &D, const llvm::Triple& Triple,
- const llvm::Triple& ToolTriple);
+ NetBSD(const Driver &D, const llvm::Triple& Triple);
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA,
const ActionList &Inputs) const;