Questions about this topic? Sign up to ask in the talk tab.

C/Compilation

From NetSec
Jump to: navigation, search

What is something that all C programmers use? A compiler. What is something that all Linux C programmers use? GCC. It is a fundamental tool for all C programmers. Without it, our code would just be useless source and would have no purpose other than to be read, perhaps. In this article i will be explaining the process of how the compiler produces binary from source code and how your code becomes a working executable. There are many C compilers out there, for both *nix systems and Windows systems, in this article we will be focusing on Linux GCC, the GNU C Compiler.

During GCC compilation, the source code goes through three phases:

- Front End

In this phase the original source code is transformed into an IR (Intermediate Representation) called AST (Abstract Syntax Tree), this form is a lot easier to read and is used to check the validity of the source. AST is just one of many Intermediate Representations that is manipulated by the compiler.


- Middle End - Back End