arm thumb2 ldr.w syntax?

Jeffrey Walton noloader@gmail.com
Thu Sep 15 04:07:00 GMT 2011


On Wed, Sep 14, 2011 at 5:28 PM, Roland McGrath <mcgrathr@google.com> wrote:
> The disassembler shows me this for a Thumb2 instruction of interest:
>
>  28:   f8dc c000       ldr.w   ip, [ip]
>
> But I cannot figure out how to make the assembler emit that.
I've run across similar when trying to generate Thumb instructions on
an ARM. In my case, I could not get ADDS generated (the instruction
was being rejected as invalid). Instead of 'ADDS, r1, r1, r0', I
needed to emit the instruction manually:

__asm__
(
  "ldr  r0, %[xa]   ;"  // R0 = a
  "ldr  r1, %[xb]   ;"  // R1 = b
  ".short 0x1809    ;"  // 'adds r1, r1, r0'
  ...
);

Jeff



More information about the Binutils mailing list