What is PC-relative addressing?

Specifying a branch target or data address as a distance from the current instruction's address (PC). The distance is unchanged wherever the program is loaded, so it underpins position-independent code.

Field: ISA & Assembly

PC-relative addressing in the explanations

Questions that mention PC-relative addressing (2)

  1. What is an advantage of using PC-relative addressing for branches and jumps?
  2. In the RISC-V conditional branch "beq a0, a1, label", how is the target address of label encoded?

Related terms

Position-independent code Branch prediction Addressing mode Application binary interface (ABI) Assembler Branch delay slot Callee-saved register Caller-saved register Calling convention Compressed instruction

Back to the glossary