risc-v

Definition

gp ( RISC-V)

gp is the RISC-V integer register x3, designated as the global pointer. It holds a fixed address that provides a stable base for accessing global variables and thread-local storage at a constant offset.

The value of gp is typically set once during program initialisation to point into the global data segment, allowing data accesses via small immediate offsets. This design reduces the code size of instructions that reference globals, as the base address need not be loaded separately for each access.