Load a register with either a 32-bit or 64-bit immediate value or an address.
NoteThis description is for the
LDRpseudo-instruction only, and not for the
Is the register to load with a 32-bit value.
Is the register to load with a 64-bit value.
Evaluates to a numeric value.
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
in a literal pool and
generates a PC-relative
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
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.
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.
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