1, 2, 3, 4… Compiled! -All about gcc.

Preprocessor

In this stage, lines starting with a # character are interpreted by the preprocessor as preprocessor commands. These commands form a simple language of their own with its own syntax and semantics. This language is used to reduce repetition in source code by providing functionality to inline files, define macros, and to conditionally omit code.

Compiler

The second stage of compilation is confusingly enough called compilation. In this stage, the preprocessed code is translated to assembly instructions specific to the target processor architecture. These form an intermediate human readable language — we will see examples below.

Assembler

During this stage, an assembler is used to translate the assembly instructions to object code. Object code does not refer to object as in a “thing” like we use that word, but it refers to machine readable language. The output consists of actual instructions to be run by the target processor. This step will finish the process of turning the code into binary.

Linker

The object code generated in the assembly stage is composed of machine instructions that the processor understands but some pieces of the program are out of order or missing. To produce an executable program, the existing pieces must be rearranged and the missing ones filled in. This process is called linking.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store