What you need to know about gcc.

Nour Ouhichi
2 min readMay 27, 2020

gcc is a compiler , but what is a compiler. In order to better understand gcc and its uses let us begin with understanding the concept of a compiler.

What does a compiler do:

A compiler converts a program from a human-readable format into machine-readable format.

To enable a machine to read a program there are different steps:

1-Processing:

Each line starting with # is interpreted by the processor as processor commands. This is where processor directives are expanded.Performing this step requires that gcc executes these commands internally.

2-Compilation:

At this point he code is translated into assembly instructions specific to the processor architecture.A certain compiler translates main.c into main.s. File helloworld.s contains assembly code. You can explicitly tell gcc to translate helloworld.i to helloworld.s by executing the following command.

[root@host ~]# gcc -S helloworld.i

Now , it is time to play with 0 and 1

3-assembley:

The code is translated by the assembler into machine language instructions which is the binary

3-Linking:

During linking the pieces of object code is arranged so that the function in other files can call functions in some other files. It also adds back the part containing the library functions used by the program. The end result being that now you have an executable program.

--

--

Nour Ouhichi

Software engineering student at Holberton school with the passion of sharing my knowledge. Simplified language articles about different programming languages.