summaryrefslogtreecommitdiffstats
path: root/lib/Driver/ToolChain.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-01-18 16:23:48 +0000
committerdim <dim@FreeBSD.org>2015-01-18 16:23:48 +0000
commitc86b984ea8ecb3e944dc3de48539f4c1f65851ea (patch)
tree3eb853da77d46cc77c4b017525a422f9ddb1385b /lib/Driver/ToolChain.cpp
parentc696171ff15f0ee60dea4abfd99a135473c95656 (diff)
downloadFreeBSD-src-c86b984ea8ecb3e944dc3de48539f4c1f65851ea.zip
FreeBSD-src-c86b984ea8ecb3e944dc3de48539f4c1f65851ea.tar.gz
Vendor import of clang RELEASE_360/rc1 tag r226102 (effectively, 3.6.0 RC1):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_360/rc1@226102
Diffstat (limited to 'lib/Driver/ToolChain.cpp')
-rw-r--r--lib/Driver/ToolChain.cpp36
1 files changed, 33 insertions, 3 deletions
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
index 4f90d08..2bcfecf 100644
--- a/lib/Driver/ToolChain.cpp
+++ b/lib/Driver/ToolChain.cpp
@@ -27,8 +27,13 @@ using namespace clang;
using namespace llvm::opt;
ToolChain::ToolChain(const Driver &D, const llvm::Triple &T,
- const ArgList &A)
- : D(D), Triple(T), Args(A) {
+ const ArgList &Args)
+ : D(D), Triple(T), Args(Args) {
+ if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
+ if (!isThreadModelSupported(A->getValue()))
+ D.Diag(diag::err_drv_invalid_thread_model_for_target)
+ << A->getValue()
+ << A->getAsString(Args);
}
ToolChain::~ToolChain() {
@@ -50,7 +55,7 @@ const SanitizerArgs& ToolChain::getSanitizerArgs() const {
return *SanitizerArguments.get();
}
-std::string ToolChain::getDefaultUniversalArchName() const {
+StringRef ToolChain::getDefaultUniversalArchName() const {
// In universal driver terms, the arch name accepted by -arch isn't exactly
// the same as the ones that appear in the triple. Roughly speaking, this is
// an inverse of the darwin::getArchTypeForDarwinArchName() function, but the
@@ -124,6 +129,7 @@ Tool *ToolChain::getTool(Action::ActionClass AC) const {
case Action::AnalyzeJobClass:
case Action::MigrateJobClass:
case Action::VerifyPCHJobClass:
+ case Action::BackendJobClass:
return getClang();
}
@@ -201,6 +207,19 @@ ObjCRuntime ToolChain::getDefaultObjCRuntime(bool isNonFragile) const {
VersionTuple());
}
+bool ToolChain::isThreadModelSupported(const StringRef Model) const {
+ if (Model == "single") {
+ // FIXME: 'single' is only supported on ARM so far.
+ return Triple.getArch() == llvm::Triple::arm ||
+ Triple.getArch() == llvm::Triple::armeb ||
+ Triple.getArch() == llvm::Triple::thumb ||
+ Triple.getArch() == llvm::Triple::thumbeb;
+ } else if (Model == "posix")
+ return true;
+
+ return false;
+}
+
std::string ToolChain::ComputeLLVMTriple(const ArgList &Args,
types::ID InputType) const {
switch (getTriple().getArch()) {
@@ -221,6 +240,17 @@ std::string ToolChain::ComputeLLVMTriple(const ArgList &Args,
}
return Triple.getTriple();
}
+ case llvm::Triple::aarch64: {
+ llvm::Triple Triple = getTriple();
+ if (!Triple.isOSBinFormatMachO())
+ return getTripleString();
+
+ // FIXME: older versions of ld64 expect the "arm64" component in the actual
+ // triple string and query it to determine whether an LTO file can be
+ // handled. Remove this when we don't care any more.
+ Triple.setArchName("arm64");
+ return Triple.getTriple();
+ }
case llvm::Triple::arm:
case llvm::Triple::armeb:
case llvm::Triple::thumb:
OpenPOWER on IntegriCloud