LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 18202 - No support for delayed constants in ARM integrated assembler
Summary: No support for delayed constants in ARM integrated assembler
Status: NEW
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: ARM (show other bugs)
Version: trunk
Hardware: PC Windows NT
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks: 18926 21420
  Show dependency tree
 
Reported: 2013-12-10 16:04 PST by David Peixotto
Modified: 2016-03-30 11:06 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Peixotto 2013-12-10 16:04:25 PST
I have some assembly code that uses .equ to set a symbol to a computed constant. It works in GCC but not LLVM.  I am not sure about the correct terminology, but here is an example:

  .syntax unified
  .equ size, end - start 
  add r0, r0, #size

  start:
  .space 0x10
  end:

GCC will compile this to `add r0, r0, #16`. Compiling with llvm-mc gives:

  set.s:4:13: error: invalid operand for instruction
  add r0, r0, #size
              ^
It works for llvm-mc if the #size is set to a constant (e.g. .set size, 0x10).
Comment 1 Renato Golin 2013-12-11 04:33:33 PST
This is the same as .set, but neither seem available for ARM assembly. Not sure about other architectures, but I think this should be supported as is.

This is remarkably similar to what exception handling tables do:

.Lset0 = .Leh_func_begin0-.Leh_func_begin0 # >> Call Site 1 <<

So, it's possible that support is already there, but disconnected from this specific case, since this also fails:

  .syntax unified
  size = end - start
  add r0, r0, #size

  start:
  .space 0x10
  end:

I'm not sure this is due to the lack of .set/.equ/= directives (which would have produced an error earlier), I believe this is just an issue with literals using computed constants, since this also fails:

  .syntax unified
  add r0, r0, #SYM

SYM:
  .byte 0x4