Quiz Entry - updated: 2026.07.10
What are the two main steps a linker performs?
First symbol resolution (match every symbol reference to exactly one definition), then relocation (merge sections and patch references to their final addresses).
* Resolution must run first — addresses can't be assigned until every symbol's single definition is known. *
The order is forced: you can't compute final addresses until you know which symbols exist and where each is defined, so resolution must come before relocation.
Step 1: Symbol Resolution
- Programs define and reference symbols (functions and variables)
- Symbol definitions are stored in a symbol table
- Each entry contains: name, size, and location
- Goal: Associate each symbol reference with exactly one symbol definition
Step 2: Relocation
- Merge separate code and data sections into single sections
- Convert relative offsets from
.ofiles to absolute addresses in the executable - Update all symbol references to reflect their new positions
Why this order? You can't calculate final addresses (relocation) until you know which symbols exist and where they're defined (resolution).
Go deeper:
Symbol table (Wikipedia) — the data structure resolution walks to bind each reference to a definition.
Eli Bendersky — Load-time relocation of shared libraries — a worked example of the relocation half, with real disassembly.