Non-Confidential | ![]() | DUI0801J | ||
| ||||
Home > A64 Data Transfer Instructions > LDR pseudo-instruction |
Load a register with either a 32-bit or 64-bit immediate value or an address.
LDR
pseudo-instruction only, and not for
the LDR
instruction.LDR
Wd
, =expr
LDR
Xd
, =expr
LDR
Wd
, =label_expr
LDR
Xd
, =label_expr
where:
Wd
Is the register to load with a 32-bit value.
Xd
Is the register to load with a 64-bit value.
expr
Evaluates to a numeric value.
label_expr
Is a PC-relative or external expression of an address in the form of a label plus or minus a numeric value.
When using the LDR
pseudo-instruction, the assembler places the
value of
or
expr
in a literal pool and
generates a PC-relative label_expr
LDR
instruction that reads the constant
from the literal pool.
An address loaded in this way is fixed at link time, so the code is not position-independent.
The address holding the constant remains valid regardless of where the
linker places the ELF section containing the LDR
instruction.
If
is an external
expression, or is not contained in the current section, the assembler places
a linker relocation directive in the object file. The linker generates
the address at link time.label_expr
If
is a local
label, the assembler places a linker relocation directive in the
object file and generates a symbol for that local label. The address
is generated at link time.label_expr
The offset from the PC to the value in the literal pool must be less than ±1MB . You are responsible for ensuring that there is a literal pool within range.
LDR w1,=0xfff ; loads 0xfff into W1 ; => LDR w1,[pc,offset_to_litpool] ; ... ; litpool DCD 4095 LDR x2,=place ; loads the address of ; place into X2 ; => LDR x2,[pc,offset_to_litpool] ; ... ; litpool DCQ place