14 GOT-indirect addressing
The following example shows how to load an address from the GOT:
1:
auipc a0, %got_pcrel_hi(msg + 1)
ld a0, %pcrel_lo(1b)(a0)
This generates the following instructions and relocations as seen by objdump
(for RV64; RV32 will use lw instead of ld):
0000000000000000 \<.text>:
0: 00000517 auipc a0,0x0
0: R_RISCV_GOT_HI20 msg+0x1
4: 00053503 ld a0,0(a0) # 0 \<.text>
4: R_RISCV_PCREL_LO12_I .L1