Let's start with a simple hello world program. Call it, hello_world.c
.
We're going to understand the process this little file with human readable text goes through to become a machine readable
executable binary file. We will intentionally run the intermediate commands with gcc just to know what happens where.
Takes all header files and includes them in source. Expands and inlines macros Strips out all comments
gcc -E -o hello_world_ext.c hello_world.c
Semantic analysis Error checking Checks for and removes dead code
gcc -S hello_world_ext.c
Converts it into an assembly object file.
gcc -c hello_world.s
Takes object file and combine with all libraries required to create an executable.
gcc -o hello_world hello_world.c