Christian Rojas
3 min readJun 17, 2021

--

“Programmers write programs in a form called source code. Source code must go through several steps before it becomes an executable program. The first step is to pass the source code through a compiler, which translates the high-level language instructions into object code. The linker combines modules and gives real values to all symbolic addresses, thereby producing machine code.”

So, if there’s a “compilation” process, there must be a tool to perform this work. Yes, there is one such thing and it is known by the name of a compiler, Now let us see what a compiler is exactly.

What is a compiler?

A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or “code” that a computer’s processor uses. Typically, a programmer writes language statements in a language such as C, one line at a time using an editor. The file that is created contains what are called the source statements. The programmer then runs the appropriate language compiler, specifying the name of the file that contains the source statements.When executing (running), the compiler first parses (or analyzes) all of the language statements syntactically one after the other and then, in one or more successive stages or “passes”, builds the output code, making sure that statements that refer to other statements are referred to correctly in the final code. Traditionally, the output of the compilation has been called object code or sometimes an object module. The object code is machine code that the processor can execute one instruction at a time. Traditionally in some operating systems, an additional step was required after compilation — that of resolving the relative location of instructions and data when more than one object module was to be run at the same time and they cross-referred to each other’s instruction sequences or data. This process was sometimes called linkage editing and the output known as a load module.

Linking

The linker is what produces the final compilation output from the object files that the compiler produced. This output can be either a shared library or an executable. It links all the object files by replacing the references to undefined symbols with the correct addresses. Each of these symbols can be defined in other object files or in libraries. If they are defined in libraries other than the standard library, you need to tell the linker about them.

--

--