]> granicus.if.org Git - clang/commitdiff
[ARM] Pass thumb as architecture to the underlying tools, when targeting windows
authorRenato Golin <renato.golin@linaro.org>
Wed, 27 Jul 2016 14:12:20 +0000 (14:12 +0000)
committerRenato Golin <renato.golin@linaro.org>
Wed, 27 Jul 2016 14:12:20 +0000 (14:12 +0000)
This makes sure that the thumb section flag gets set by the assembler.

Patch by Martin Storsjö.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@276869 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChain.cpp
test/Driver/windows-thumb.s [new file with mode: 0644]

index 91b364128c9753fee49faef44df57804de6d3961..e5e17a5659c6f137a9adc0a3e12b6c3d8297b7a3 100644 (file)
@@ -493,8 +493,10 @@ std::string ToolChain::ComputeLLVMTriple(const ArgList &Args,
       ArchName = "arm";
 
     // Assembly files should start in ARM mode, unless arch is M-profile.
+    // Windows is always thumb.
     if ((InputType != types::TY_PP_Asm && Args.hasFlag(options::OPT_mthumb,
-         options::OPT_mno_thumb, ThumbDefault)) || IsMProfile) {
+         options::OPT_mno_thumb, ThumbDefault)) || IsMProfile ||
+         getTriple().isOSWindows()) {
       if (IsBigEndian)
         ArchName = "thumbeb";
       else
diff --git a/test/Driver/windows-thumb.s b/test/Driver/windows-thumb.s
new file mode 100644 (file)
index 0000000..afe5b2d
--- /dev/null
@@ -0,0 +1,2 @@
+; RUN: %clang -target armv7-windows -c -### %s 2>&1 | FileCheck %s
+; CHECK: "-triple" "thumbv7-