diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Driver/ToolChain.cpp | 13 | ||||
-rw-r--r-- | lib/Driver/ToolChains.cpp | 10 | ||||
-rw-r--r-- | lib/Driver/ToolChains.h | 6 | ||||
-rw-r--r-- | lib/Driver/Tools.cpp | 3 |
4 files changed, 21 insertions, 11 deletions
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp index d83fd9af25..074f1a3481 100644 --- a/lib/Driver/ToolChain.cpp +++ b/lib/Driver/ToolChain.cpp @@ -169,7 +169,8 @@ static const char *getLLVMArchSuffixForARM(StringRef CPU) { return ""; } -std::string ToolChain::ComputeLLVMTriple(const ArgList &Args) const { +std::string ToolChain::ComputeLLVMTriple(const ArgList &Args, + types::ID InputType) const { switch (getTriple().getArch()) { default: return getTripleString(); @@ -187,7 +188,10 @@ std::string ToolChain::ComputeLLVMTriple(const ArgList &Args) const { bool ThumbDefault = (Suffix == "v7" && getTriple().getOS() == llvm::Triple::Darwin); std::string ArchName = "arm"; - if (Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, ThumbDefault)) + + // Assembly files should start in ARM mode. + if (InputType != types::TY_PP_Asm && + Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, ThumbDefault)) ArchName = "thumb"; Triple.setArchName(ArchName + Suffix.str()); @@ -196,7 +200,8 @@ std::string ToolChain::ComputeLLVMTriple(const ArgList &Args) const { } } -std::string ToolChain::ComputeEffectiveClangTriple(const ArgList &Args) const { +std::string ToolChain::ComputeEffectiveClangTriple(const ArgList &Args, + types::ID InputType) const { // Diagnose use of Darwin OS deployment target arguments on non-Darwin. if (Arg *A = Args.getLastArg(options::OPT_mmacosx_version_min_EQ, options::OPT_miphoneos_version_min_EQ, @@ -204,7 +209,7 @@ std::string ToolChain::ComputeEffectiveClangTriple(const ArgList &Args) const { getDriver().Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); - return ComputeLLVMTriple(Args); + return ComputeLLVMTriple(Args, InputType); } ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{ diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 5e0378525b..5ed9dc8970 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -189,8 +189,9 @@ Darwin::~Darwin() { delete it->second; } -std::string Darwin::ComputeEffectiveClangTriple(const ArgList &Args) const { - llvm::Triple Triple(ComputeLLVMTriple(Args)); +std::string Darwin::ComputeEffectiveClangTriple(const ArgList &Args, + types::ID InputType) const { + llvm::Triple Triple(ComputeLLVMTriple(Args, InputType)); // If the target isn't initialized (e.g., an unknown Darwin platform, return // the default triple). @@ -958,8 +959,9 @@ bool Darwin::SupportsObjCGC() const { } std::string -Darwin_Generic_GCC::ComputeEffectiveClangTriple(const ArgList &Args) const { - return ComputeLLVMTriple(Args); +Darwin_Generic_GCC::ComputeEffectiveClangTriple(const ArgList &Args, + types::ID InputType) const { + return ComputeLLVMTriple(Args, InputType); } /// Generic_GCC - A tool chain using the 'gcc' command to perform diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h index 10c416a5fb..c7771170b8 100644 --- a/lib/Driver/ToolChains.h +++ b/lib/Driver/ToolChains.h @@ -89,7 +89,8 @@ public: Darwin(const HostInfo &Host, const llvm::Triple& Triple); ~Darwin(); - std::string ComputeEffectiveClangTriple(const ArgList &Args) const; + std::string ComputeEffectiveClangTriple(const ArgList &Args, + types::ID InputType) const; /// @name Darwin Specific Toolchain API /// { @@ -292,7 +293,8 @@ public: Darwin_Generic_GCC(const HostInfo &Host, const llvm::Triple& Triple) : Generic_GCC(Host, Triple) {} - std::string ComputeEffectiveClangTriple(const ArgList &Args) const; + std::string ComputeEffectiveClangTriple(const ArgList &Args, + types::ID InputType) const; virtual const char *GetDefaultRelocationModel() const { return "pic"; } }; diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 4d4abff639..cd86f16744 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -2230,7 +2230,8 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA, // Add the "effective" target triple. CmdArgs.push_back("-triple"); - std::string TripleStr = getToolChain().ComputeEffectiveClangTriple(Args); + std::string TripleStr = + getToolChain().ComputeEffectiveClangTriple(Args, Input.getType()); CmdArgs.push_back(Args.MakeArgString(TripleStr)); // Set the output mode, we currently only expect to be used as a real |