◄ WORLD V · SONNY 5DART 163 · a helldive at the net

STATIC LINKING resolve the undefined symbol; patch the address

A compiler emits each module not knowing where the others will sit in memory or what address an external function will have, so it leaves a relocation: “patch this slot with the address of f once you know it.” The linker lays the modules out at chosen base addresses, builds a global symbol table of every definition, then walks each relocation and writes base + offset into the slot. Separate compilation, resolved.

THE TECHNIQUE lay out, resolve, relocate

Module B calls f, which module A defines. The linker places A at one base and B at another, resolves f to baseA + offset, and patches B’s call slot. Watch the undefined symbol resolve and the relocation apply: live demo


HISTORY & CREDIT relocating linkers; systems folklore

“The linker just concatenates object files.” — no. It lays out sections at addresses, builds a cross-file symbol table, resolves every undefined reference to a definition (erroring on missing or duplicate symbols), and rewrites addresses via relocations. Concatenation is the easy part; relocation is the job. cited

1947–48 · Goldstine & von Neumann — an early theoretical trace: subroutines “formed for possible substitution” + substitution sequences (Part II, 1948) — the germ of relocation, not a working mechanism.
1949 / 1951 · Wheeler (EDSAC initial orders) and Wilkes, Wheeler & Gill (1951) — the first practical relocatable-subroutine mechanism.
1950s–60s · relocating loaders and linkage editors (IBM) — separate compilation demands symbol resolution + relocation; the linkage editor becomes a standard tool.
1990s · ELF / Levine (“Linkers and Loaders”, 1999) — the modern relocation-type zoo and dynamic linking (dart’s static cousin).

A relocation is a tiny instruction to the linker: at this offset, of this type, add the address of this symbol. Static linking applies them at build time; dynamic linking defers them to load time. relocating loaders / Levine 1999

RECOMMEND FOR I-13 the resolved address, computed

Resolving the external symbol and applying the relocation run on the canonical compiler:

$ i13 run link.i13 # f = base(A) + offset(f); patch B's call slot resolved_f = 4160 -- baseA 4096 + offset_f 64 call_operand_before = 0 -- B's call to f: unresolved call_operand_after = 4160 -- relocation applied: patched with f's final address
Recommend: static linking is LIT in its arithmetic — the canonical compiler resolves external f to baseA + offset = 4160 and patches module B’s call from 0 to 4160. This is the model for an I-13 that ever compiles modules separately: a symbol table (name/address arrays), a relocation list (offset + symbol), and one pass that writes base + offset into each slot — all plain integer arithmetic on arrays. It finishes across files what the two-pass assembler (162) starts within one; the corpus’s own creed ADDRESS ≠ AUTHORITY, ARRIVAL ≠ EXECUTION is exactly a relocation discipline.