[PATCH] ARM: Emit ".code 16" before global inline-asm instructions in thumb mode
echristo at gmail.com
Fri Jul 25 11:19:17 PDT 2014
On Fri, Jul 25, 2014 at 1:32 AM, Renato Golin <renato.golin at linaro.org> wrote:
> On 25 July 2014 01:29, Eric Christopher <echristo at gmail.com> wrote:
>> Does gcc emit a .code16 for file level inline assembly when compiling
>> with -mthumb?
> Yes, the patch is in line with GCC's behaviour, and I honestly thought
> we were doing this, already... :/
Anyhow, if that's what we do, then that's what we do.
> We could do better, however, because we do parse and validate inline
> assembly. We should be able to tell if the snippet contains ARM/Thumb
> code or any .code modifiers, and thus only change after the inline asm
> if really needed.
> Saleem, I remember you had a look at that, didn't you have a working prototype?
> For now, the patch looks good and would be perfect for 99% of the
> cases and mostly harmless for the rest. The only problem is if the
> code was in ARM mode, with Thumb code in the snippet changed via
> .code16, and the user forgot to change it back to ARM before the end
> of the snippet. But that's advanced user stupidity detection, and is
> an enhancement at best.
> Thanks for spotting that!
More information about the llvm-commits