[PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

Renato Golin via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 27 09:59:21 PDT 2015

rengolin added inline comments.

Comment at: lib/Driver/ToolChain.cpp:485
@@ +484,3 @@
+    if ((ARM::parseArchProfile(Suffix) == ARM::PK_M) ||
+        (InputType != types::TY_PP_Asm &&
+         Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, ThumbDefault)))
labrinea wrote:
> Alternatively we could remove the check of InputType. I am not sure why this and the above comment are present anyway.
I agree with you, this logic is inconsistent.

Historically, ARM assembly (especially inline assembly) is assumed ARM unless told otherwise. This is why you have to specify ".thumb" and not ".arm". However, that doesn't mean the assembly file *has* to be ARM, even if the arch name is "thumbvN" or if "-mthumb" is specified.

Not even GNU tools behave in such odd ways, so I think we should be consistent. If the triple is thumb, asm is thumb. If we have -mthumb, asm is thumb. If not, it's arm. Precisely how everything else works, so it's only logical that we should remove the InputType check.


More information about the cfe-commits mailing list