FREE LESSON · Machine code & execution · 3 OF 4

Linking, Loading and Object Files Explained

From object file to running image — Symbols, relocation, linking, and loading

Compilation rarely knows every final address.

An object file contains machine code and data plus symbols, sections, and relocation records. A linker resolves cross-file references and lays out an executable or shared object. A loader maps segments, establishes process state, and performs required dynamic resolution before transferring control to an entry point.

Names become addresses in stages; each stage leaves evidence in the binary.

Static and dynamic linking move the boundary

Static linking copies selected library code into the executable, increasing independence and size. Dynamic linking resolves shared libraries at load or run time, enabling sharing and updates but adding deployment and compatibility dependencies. Neither is universally superior; the product’s update, footprint, security, and portability needs decide.

A dependency removed from build time usually reappears as an operational contract.
Open this lesson in the interactive course →