[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 10:29:02 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)))
t.p.northover wrote:
> rengolin wrote:
> > 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.
> I suspect the issue is with our weirdness. When I remove the TY_PP_Asm check "clang -arch armv7 -c tmp.s" defaults to Thumb-mode. I think I'd be lynched by the OS-folks if that changed.
> (That's basically the entire content of the Radar Chad referred to in his original addition).
Well, that's clearly a bug. I'm ok with this going is as it is, but would be good to create a new bug to solve this mess.


More information about the cfe-commits mailing list