What happens when you type gcc main.c
From readable program to an executable code, how does it happen? moving from a high level language to a lower “metallic” one, which path our idea went through?
Well, it’s a four steps process guided by the Gnu GCC compiler. In order to decipher some compilation basics, we are going with a real simple program to print the “Hello, Holberton!”.
The source code
The source code is the fundamental component of a program, written by a specific programming language as we did in the example below using the C, that presents the first input in the compilation process where the file is marked with “.c” extension.
file hello.c /* hello.c: C source, ASCII text */
Preprocessor
The preprocessor is the first step from the compilation that takes the source code and eliminate comments, prepares all the header and external requirement and changes the macro with his values. It’s possible to see the affect of the preprocessor directly using the -E flag
gcc -E hello.c > preprocessed_hello
Compiler
The next stage, the compiler takes a preprocessed program and transform it to the Assembly language; a low level language known by the sequential structure form. Since ASM is very close to the machine comprehension it depends on the processor architecture. So to print out our assembly language for the program we use -S flag (may be we use -masm to specify the dialect).
gcc -S hello.c
Assembler
Each assembly sequence converted into a machine code using an utility program referred to us as assembler; is a translator to the operation code “opcode” typically handles the constant calculation and resolving data location.
Linker
The linker is the final step of compilation, it takes care of gathering all the execution requirement as object files and libraries and joining them to one single executable file.

Therefore, accomplishing this four steps procedure allow us to track the hidden hard work done by the compiler and retrace the path taken by a simple program to come to life.
At the end, we have to thank the father of the operating system Gnu Richard Stallman for this work of art.