Learning GCC

Paola Andrea Garcia Altamirano
2 min readJun 22, 2021

We must know that GCC contains a series of compilers which are useful for compiling programs written in C, C ++, Java and Objective C among others.
GCC was originally written as the compiler for the GNU operating system.


GCC has four stages Preprocessing, compilation, assembly and connection

Compilation stage in GCC
  • Preprocess: Generate .i file

The C language code is first preprocessed with the include “include” functions and performs a conditional compilation handling the declarations keeping the ones that meet the compilation conditions and removing the others.

  • Compile:

In this process, the result of the preprocessing is taken and an assembly language file with an “.s” extension is generated; in this process the syntax is checked, paying attention to external functions and variables.

  • Assemble:

After the compiler delivers the assembly file, it carries out a process for it to be translated into machine language and it is called an object file and its extension is “.o”

  • Connect:

The file generated by the “.o” extension handler cannot be used directly. The process of converting the target file into a form that is finally usable is called binding. When using a library, library loading is handled at this stage.