[PATCH] Fix inline assembly that switches between ARM and Thumb modes

Jim Grosbach grosbach at apple.com
Mon Dec 16 09:45:19 PST 2013

Hi Greg,

I don’t follow which case you’re concerned about. It’s never correct for the inline assembly to exit in a different mode (arm vs. thumb) than how it entered, so it will always be correct to just reset the mode at the end.


On Dec 15, 2013, at 10:18 AM, Greg Fitzgerald <garious at gmail.com> wrote:

>  Renato, reverting the mode correctly is not too easy.  It isn't enough to set the feature bits back to what they were.  We'd need to detect if the .arm/.thumb directive is missing and if the adr and its label are missing.  And for anything missing, inject it.
>  I think the latest patch here is an improvement over the current situation.  Rather than generate broken machine code, it allows switching between thumb and arm modes and vice versa, and it detects when the user code failed to switch back.
>  I don't disagree that there's more that could be done here, but I think Step 1 is to fix the correctness bug with the least invasive change, and that's the aim of this patch.
> http://llvm-reviews.chandlerc.com/D2255

More information about the llvm-commits mailing list