IT lexicon › Programming › Relocation

Relocation

Programming På svenska → Updated: 2026-11-05

A note in an object file saying that an address here is unknown and must be filled in later, by the linker or the loader.

When the compiler translates one file, it doesn't know where functions in other files will end up, or even where its own code will live. So it leaves placeholders plus a list of relocation entries: which spot to patch, which symbol is meant and how to compute the address — R_X86_64_PC32, for instance, for an address relative to the instruction pointer.

The linker resolves most of them. Whatever remains for shared libraries is done by the dynamic loader at startup, and every page it writes to becomes private instead of shared between processes. That is why position-independent code exists, funnelling the fix-ups into the GOT. Red Hat's prelink precomputed relocations for faster startup, until ASLR turned predictable addresses into a security liability.

← Back to the lexicon