Switching to and from ARM/Thumb

Daniel Jacobowitz drow@false.org
Tue Jan 18 01:45:00 GMT 2005


On Mon, Jan 17, 2005 at 05:18:06PM -0800, Shaun Jackman wrote:
> Does gas insert zero bytes for alignment? and is this a reasonable nop
> instruction? gas compiles 'nop' to 46c0 nop (mov r8, r8).

I believe it will align with nops.

> > .code32
> > arm_to_thumb:
> > #ifdef __ARMv4T__
> >  add ip, pc, #1
> >  bx ip
> > #else
> >  sub pc, pc, #1
> > #endif
> > thumb_code:
> 
> If this is used in inline assembler, does gcc need to be informed of
> ip being trashed?

Definitely.  I admit I've never seen the arm-to-thumb sequence done
quite that way before... I knew loads interworked and mov didn't so I
would have assumed that sub didn't either.

-- 
Daniel Jacobowitz



More information about the Binutils mailing list