I’m trying to understand how labels are used by GNU as. In the exception vector table of a working program, I see:
_vectors: ldr PC, Reset_Addr
...
Reset_Addr: .word Reset_Handler
Another variation on the syntax, from another program:
_start: ldr pc, =reset
...
reset: ...
I have been assuming so far that Reset_Addr is an absolute address, but according to the ARM System Developer’s Guide, a [Register, offset] must be used as the operands for LDR. In fact, I have not found any documentation anywhere that supports the syntax above.
The “using as” documentation did not elaborate:
“The symbol then represents the current value of the active location counter, and is, for example, a suitable instruction operand.”
On the other hand, the ARM System Developer’s Guide has the following code snippet:
LDR r0, [pc, #constant_number-8-{PC}]
...
constant_number
DCD 0xff00ffff
In this case, the label constant_number seems to be an absolute value.
Could someone please set me straight about using labels with LDR, and/or point me toward some practical as documentation?