Compilation Pipeline

The four stages that turn .c into an executable: preprocessor (cpp) → compiler (cc1, produces assembly) → assembler (as, produces object files) → linker (ld, produces the final binary). Understanding this pipeline is the first mindset shift from interpreted/JIT languages. Each stage is a separate program; gcc is just a driver that invokes them in order. Key flags: -E (stop after preprocessing), -S (stop after compilation), -c (stop after assembly). Object files contain machine code but unresolved symbols — the linker resolves them.

Appears In

m01-c-is-not-java