How is the process to Compile with GCC
GCC is a GNU Compiler Collection very important know his use to program in C

What is GNU?
In 1983 Richard Stallman announced the GNU Linux project (pronounced: GNOO LIN-əks), which was developed as a derivative of the UNIX operating system. The project gained so much popularity that Richard and others founded the Free Software Foundation in 1985. Richard has been very outspoken on some of the early development of GNU and Linux. Research shows that the OS known as Linux is based on the Linux kernel but all other components are GNU based. Many software enthusiasts believe that for Linus Torvalds to name Linux.. well... Linux was unethical and that it should have been named GNU/Linux or GNU Linux to give credit to Richard’s contributions.
What is GCC?
The abbreviation GCC stands for GNU Compiler Collection and was originally written to be the compiler for the GNU OS. It contains compilers for the following languages:
C, C++, Objective-C, Fortran, Java, and more.
The GCC compiler was written in C and accepts options and file names as arguments so that engineers can have absolute control over the compilation process.

$ man GCC
As you can see above there are many different options to pass into the GCC function and at the very end, you can see in @file and an infill. This just basically lets a programmer specify what file should be used as input and what file they would like to specify as their output file. Many advanced software projects utilize the output of one file as the input into another file to solve a task.
When you have ready your program in C you push compiler GCC to create the executable program but internally he has four steps that are:
PREPROCESSING
This step does the following: Removal of Comments, Expansion of Macros, Expansion of the included files.
The lines in our code that begin with the “#” character are preprocessor directives. In our “HelloWorld.c” program the first preprocessor directive (#include <stdio.h>) requests a standard header file, stdio.h, to be included in our source file. If you use macros in your program, this is the stage where it gets substituted by the corresponding value. In our program, #define PRINT THIS “Hello World\n” is the macro and all occurrences of PRINT THIS will get substituted with the corresponding value, hereby the string “Hello World\n”
So in the preprocessor stage, those included header files and defined macros are expanded and merged within the source file to produce a transitory source file.
By using GCC's “-E” flag we can directly do the pre-processing operation.
COMPILER
The next step is to take the Preprocessed file as input, compile it and produce an intermediate compiled output. The output file for this stage produces Assembly code which is machine-dependent.
By using the “-S” flag with gcc we can convert the preprocessed C source code into assembly language without creating an object file
ASSEMBLER
As we all know, machines can understand only binary language, so now we require an ASSEMBLER that converts assembly code in “HelloWorld.c” file into binary code.
ASSEMBLER was one of the first software tools developed after the invention of the digital computer.
If there are any calls to external functions in the assembly code, the Assembler leaves the addresses of the external functions undefined, to be filled in later by the Linker.
The Assembler can be invoked as shown below. By using the “-c” flag in gcc we can convert the assembly code into machine-level code:
[bash]$ gcc -c HelloWorld.c -o HelloWorld.o
HelloWorld.o
The only thing we can explain by looking at the HelloWorld.o file is about the string ELF in the first line. ELF stands for executable and linkable format.
An object file and an executable file come in several formats such as ELF (Executable and Linking Format) and COFF (Common Object-File Format). For example, ELF is used on Linux systems, while COFF is used on Windows systems.
This is a relatively new format for machine-level object files and executables that are produced by GCC. Prior to this, a format known as a.out was used. ELF is said to be a more sophisticated format than a.out (We might dig deeper into the ELF format in some other future article).
If you compile your code without specifying the name of the output file, the output file produced has name ‘a.out’ but the format now have changed to ELF. It is just that the default executable file name remains the same.
LINKING
This is the final phase in which all the linking of function calls with their definitions are done. Linker knows where all these functions are implemented (Assembler has left the address of all the external functions to be called). Till this stage, GCC doesn’t know about the function like printf() . The Assembler would have left the address of the functions to be called and Linker does the final process of filling in these addresses with the actual definitions. The linker also does a few additional tasks for us. It combines our program with some standard routines that are needed to make our program run. So the final executable size is way more than the input file!






