ARM Instruction Reference
ARM DUI 0068B Copyright © 2000, 2001 ARM Limited. All r ights reserved. 4-79
4.9.1 ADR ARM pseudo-instruction
Load a program-relative or register-relative address into a register.
Syntax
ADR{cond} register,expr
where:
cond
is an optional condition code.
register
is the register to load.
expr
is a program-relative or regi ster-relative expression th at evaluates to:
a non word-aligned address within ±255 bytes
a word-aligned address within ±1020 bytes.
More distant addresses can be used if the alignment is 16 bytes or more.
The address can be either befo re or after the address of the instru ction or
the base register (see Regist er-relative and program- relative expressions
on page3-23).
Note
For program-relative expressions, the given range is relative to a point
two words after the address of the current instruction.
Usage
ADR
always assembles to one instruction. The assembler attempts to produce a single
ADD
or
SUB
instruction to load the address. If the address cannot be constructed in a single
instruction, an error is generated and the assembly fails.
ADR
produces position-independent code, because the address is program-relative or
register-relative.
Use the
ADRL
pseudo-instruction to assemble a wider range of effective addresses.
If
expr
is program-relative, it m ust evaluate to an addr ess in the same co de section as the
ADR
pseudo-instruction.
Example
start MOV r0,#10
ADR r4,start ; => SUB r4,pc,#0xc