= Relocation (computing)
{wiki}
<Relocation (computing)> adjusts references in program components to match the addresses assigned during <linking (computing)> or loading. A relocation record identifies a place to patch, a target symbol and an architecture-dependent rule for computing the replacement. Moving a section changes the addresses associated with its contents, even when their relative arrangement stays fixed.<Sections and Relocation in the GNU Assembler manual>[§4.1 Background: assigning section addresses and adjusting references]{ref}
In an illustrative absolute-address rule, a symbol address $S$ and addend $A$ produce $S+A$. In a relative rule defined using reference address $P$, they may produce $S+A-P$. If $S=4176$, $P=4096$ and $A=0$, the latter gives an offset of $80$. Actual instruction encodings specify the precise reference point, scaling and allowed range, so a <linker (computing)> must apply the relocation type's rule rather than blindly adding one constant everywhere.
Back to article page