diff options
author | Alexandros Lamprineas <alexandros.lamprineas@arm.com> | 2015-10-28 10:10:03 +0000 |
---|---|---|
committer | Alexandros Lamprineas <alexandros.lamprineas@arm.com> | 2015-10-28 10:10:03 +0000 |
commit | 89ea433bd63f8d027fc66d6dbc4153464a65ec10 (patch) | |
tree | f77fed93f4cdad6cfdba6f0bb782c5149f18beba /clang/lib | |
parent | 13e4b9718cd5c050d42460b46440311477c1a4d6 (diff) | |
download | bcm5719-llvm-89ea433bd63f8d027fc66d6dbc4153464a65ec10.tar.gz bcm5719-llvm-89ea433bd63f8d027fc66d6dbc4153464a65ec10.zip |
When running clang with an arm triple such as '--target=thumbv7m-none-eabi'
that has a thumb only CPU by default (cortex-m3), and when using the assembler,
the default thumb state of the CPU does not get passed via the triple to LLVM:
$ clang -target thumbv7m-none-eabi -c -v test.s
clang -cc1as ... -triple armv7m-none--eabi ... test.s
Differential Revision: http://reviews.llvm.org/D14121
llvm-svn: 251507
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Driver/ToolChain.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index 2002a9ae8b4..ec62fba566c 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -23,10 +23,12 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/TargetRegistry.h" +#include "llvm/Support/TargetParser.h" using namespace clang::driver; using namespace clang::driver::tools; using namespace clang; +using namespace llvm; using namespace llvm::opt; static llvm::opt::Arg *GetRTTIArgument(const ArgList &Args) { @@ -466,9 +468,9 @@ std::string ToolChain::ComputeLLVMTriple(const ArgList &Args, : tools::arm::getARMTargetCPU(MCPU, MArch, Triple); StringRef Suffix = tools::arm::getLLVMArchSuffixForARM(CPU, MArch, Triple); - bool ThumbDefault = Suffix.startswith("v6m") || Suffix.startswith("v7m") || - Suffix.startswith("v7em") || - (Suffix.startswith("v7") && getTriple().isOSBinFormatMachO()); + bool IsMProfile = ARM::parseArchProfile(Suffix) == ARM::PK_M; + bool ThumbDefault = IsMProfile || (ARM::parseArchVersion(Suffix) == 7 && + getTriple().isOSBinFormatMachO()); // FIXME: this is invalid for WindowsCE if (getTriple().isOSWindows()) ThumbDefault = true; @@ -478,9 +480,9 @@ std::string ToolChain::ComputeLLVMTriple(const ArgList &Args, else ArchName = "arm"; - // Assembly files should start in ARM mode. - if (InputType != types::TY_PP_Asm && - Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, ThumbDefault)) + // Assembly files should start in ARM mode, unless arch is M-profile. + if (IsMProfile || (InputType != types::TY_PP_Asm && + Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, ThumbDefault))) { if (IsBigEndian) ArchName = "thumbeb"; |