[LLVMdev] switching ARM modes and integrated-as

Greg Fitzgerald garious at gmail.com
Mon Nov 18 18:18:48 PST 2013


Does the integrated assembler in the ARM backend support switching
between ARM and Thumb modes in the same file?  I'm having trouble with
the following assembly:

  .thumb_func
  @   Enter ARM mode
  adr r3, 1f
  bx  r3
  .align 4
  .code 32
1:  push {r7}
  mov r7, r12
  svc 0x0
  pop {r7}
  @   Enter thumb mode
  adr r3, 2f+1
  bx  r3
  .code 16
2:
  bx  lr


As a standalone .s file, GNU-as can compile it but with "clang
-integrated-as", I get errors.  If using inline assembly in a C file,
no error is reported (when compiled targeting thumb 2), but the 32-bit
ARM instructions are encoded wrongly.  The two 16-bit halves need to
be swapped.  A bug, unsupported, or perhaps just user error?

Thanks,
Greg



More information about the llvm-dev mailing list