LOGBOOK

HELP

Quiz Entry - updated: 2026.07.14

What are the steps to turn C source code into an executable?

Four stages run in sequence: preprocess → compile → assemble → link, turning .c text into a runnable binary.

The four-stage preprocess, compile, assemble, link pipeline with its artifacts.

* C becomes a program in four steps — preprocess, compile, assemble, link — each producing a concrete artifact; only the link stage pulls in libraries. *

gcc is really a driver that quietly runs four separate tools. Understanding the chain is essential for reverse engineering, because each stage produces an artifact you can inspect.

source.c → [preprocess] → .i → [compile] → .s → [assemble] → .o → [link] → executable
Stage Input Output What it does
Preprocess .c .i Expand #include, #define, conditionals
Compile .i .s Translate C into assembly text
Assemble .s .o Encode assembly into machine code (object file)
Link .o + libs executable Resolve symbols, assign addresses, pull in libraries
gcc -E source.c -o source.i   # preprocess only
gcc -S source.c -o source.s   # stop at assembly
gcc -c source.c -o source.o   # stop at object file
gcc source.o   -o program     # link to executable

Tip: gcc -S -O1 produces readable optimized assembly — the quickest way to see how the compiler turned your C into machine instructions.

Go deeper:

From Quiz: REVE1 / The Processor Interface | Updated: Jul 14, 2026