la
RISC-V la Pseudo-Instruction Details
Assembler pseudo-instructionThe RISC-V Assembly Programmer's Manual lists two la expansions: AUIPC plus ADDI with .option nopic, and AUIPC plus a GOT-based l{w|d} load with .option pic.
What You Write
la rd, symbol
Typical Real Expansion
.option nopic
auipc rd, symbol[31:12]
addi rd, rd, symbol[11:0]
.option pic
auipc rd, symbol@GOT[31:12]
l{w|d} rd, symbol@GOT[11:0](rd)
What This Pseudo Instruction Is Saving You From Writing
la selects a different address-loading sequence for .option nopic or .option pic.
How To Read The Expansion
Step 1
.option nopic uses AUIPC followed by ADDI.
Step 2
.option pic uses AUIPC followed by l{w|d} through symbol@GOT.
Official References And Reading Order
This page treats pseudo-instructions as assembler-level aliases or macros: first read what real instructions they expand to, then use the official ISA manual for the behavior of those real instructions. ABI, relocation, and linker-relaxation details follow the psABI document.
Pitfalls / Common Confusions
Do not treat either the non-PIC or PIC sequence as unconditional.
FAQ
Does la have one expansion?
No. .option nopic and .option pic use separate sequences.