summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/HostInfo.cpp
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2011-05-16 13:35:02 +0000
committerJoerg Sonnenberger <joerg@bec.de>2011-05-16 13:35:02 +0000
commit637603a7ccced82eb4166a421ce502b245586eb8 (patch)
treec2a34e99a4b11552420e45140e6b20be38d7b8e9 /clang/lib/Driver/HostInfo.cpp
parent5ec1941e5893ba5bf451e98e394ef6a47d37e50b (diff)
downloadbcm5719-llvm-637603a7ccced82eb4166a421ce502b245586eb8.tar.gz
bcm5719-llvm-637603a7ccced82eb4166a421ce502b245586eb8.zip
Make the triple an explicit argument of FindTargetProgramPath.
Preserve the original triple in the NetBSD toolchain when using -m32 or -m64 and the resulting effective target is different from the triple it started with. This allows -m32 to use the same assembler/linking in cross-compiling mode and avoids confusion about passing down target specific flags in that case like --32. llvm-svn: 131404
Diffstat (limited to 'clang/lib/Driver/HostInfo.cpp')
-rw-r--r--clang/lib/Driver/HostInfo.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/clang/lib/Driver/HostInfo.cpp b/clang/lib/Driver/HostInfo.cpp
index 198af54c035..3b1c2c73fd7 100644
--- a/clang/lib/Driver/HostInfo.cpp
+++ b/clang/lib/Driver/HostInfo.cpp
@@ -414,15 +414,20 @@ ToolChain *NetBSDHostInfo::CreateToolChain(const ArgList &Args,
(A->getOption().matches(options::OPT_m32)) ? "powerpc" : "powerpc64";
}
}
+ llvm::Triple TargetTriple(getTriple());
+ TargetTriple.setArchName(ArchName);
- ToolChain *&TC = ToolChains[ArchName];
- if (!TC) {
- llvm::Triple TCTriple(getTriple());
- TCTriple.setArchName(ArchName);
+ ToolChain *TC;
- TC = new toolchains::NetBSD(*this, TCTriple);
+ // XXX Cache toolchain even if -m32 is used
+ if (Arch == ArchName) {
+ TC = ToolChains[ArchName];
+ if (TC)
+ return TC;
}
+ TC = new toolchains::NetBSD(*this, TargetTriple, getTriple());
+
return TC;
}
OpenPOWER on IntegriCloud