<div dir="ltr">On Thu, Jul 24, 2014 at 5:27 PM, Jim Grosbach <span dir="ltr"><<a href="mailto:grosbach@apple.com" target="_blank">grosbach@apple.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">For the assembler, there’s no concept of that. It always starts in ARM mode. Even for the compiler, the defaulting to thumb mode for armv7 is a darwin only thing, I think. Used to be, anyway.<br>
</blockquote><div><br></div><div>This is also the case for Windows on ARM.  WoA is a pure Thumb-2 environment (executing ARM code, while possible from a hardware perspective, is not really allowed).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

>From another point of view, it also keeps us more compatible with other tools like gas.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Jim<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
> On Jul 24, 2014, at 5:24 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>> wrote:<br>
><br>
> Why not just start the assembler in the right mode for the target<br>
> we're assembling?<br>
><br>
> -eric<br>
><br>
> On Thu, Jul 24, 2014 at 5:19 PM, Jim Grosbach <<a href="mailto:grosbach@apple.com">grosbach@apple.com</a>> wrote:<br>
>> Hi Akira,<br>
>><br>
>> Patch LGTM. The testcase should also run with ARM (a second RUN line w/ a<br>
>> distinct check prefix) w/ check lines there to verify we don’t emit the<br>
>> “.code 16” then.<br>
>><br>
>> -Jim<br>
>><br>
>> On Jul 24, 2014, at 3:02 PM, Akira Hatanaka <<a href="mailto:ahatanak@gmail.com">ahatanak@gmail.com</a>> wrote:<br>
>><br>
>> ToT clang (correctly) errors-out when the target is armv7 (thumb2) and the<br>
>> program it's compiling has an ARM mode file-level inline assembly statement:<br>
>><br>
>> $ cat test2.c<br>
>><br>
>> __asm__ ("stmib sp, {r0-r14};");<br>
>><br>
>> $ clang -arch armv7  -S -o - test2.c<br>
>> .section __TEXT,__text,regular,pure_instructions<br>
>> .ios_version_min 5, 0<br>
>> .section __TEXT,__textcoal_nt,coalesced,pure_instructions<br>
>> .section __TEXT,__const_coal,coalesced<br>
>> .section __TEXT,__picsymbolstub4,symbol_stubs,none,16<br>
>> .section __TEXT,__StaticInit,regular,pure_instructions<br>
>> .section __TEXT,__cstring,cstring_literals<br>
>> .syntax unified<br>
>>                                        @ Start of file scope inline<br>
>> assembly<br>
>> <inline asm>:1:1: error: instruction requires: arm-mode<br>
>> stmib sp, {r0-r14};<br>
>><br>
>> However, when the .s file is generated with -no-integrated-as first, and<br>
>> then assembled later, clang completes assembling the .s file without any<br>
>> errors.<br>
>><br>
>> $ clang -arch armv7  -S -o test2.s -no-integrated-as test2.c<br>
>> $ clang -arch armv7  test2.s -c<br>
>><br>
>> The attached patch fixes this discrepancy in clang's behavior by emitting<br>
>> directive ".code 16" before global inline-asm instructions when the target<br>
>> is thumb. Without this directive, clang assembles the global inline-asm<br>
>> instruction in ARM mode, since the assembler always starts in ARM mode and<br>
>> stays in that mode until it sees directives that instruct it to switch to<br>
>> thumb.<br>
>><br>
>> <rdar://problem/17757232><br>
>><br>
>> <code16.patch>_______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
>><br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org
</div></div>