Operating Systems

Today, many high-level programming languages are in use; all are tailored toward our human way of thinking and, to a varying degree, to the needs of specialized application areas. Any program written in such a language needs to be translated into a machine-executable format. Compilers perform this step and additionally offer many kinds of correctness checks and optimizations.

This article provides an overview of the GNU Compiler Collection (GCC) and some accompanying programs such as the GNU assembler and linker. We’ll begin with the overall information flow between all these programs and also:

• Introduce the Executable and Linking Format (ELF) used to represent machine code

• Look at the tools involved, namely GCC itself, the linker, and the assembler

• Consider the run-time performance of the generated machine code

• Give an overview of improvements achieved in GCC during past years and what options a developer can apply to achieve best performance results

• Review debugging programs.

Because most parts of Linux are written in C and C++, we focus on those languages, although the GCC-based tool chain also supports other important languages such as FORTRAN and Ada.

Overall Information Flow

The process of compiling a source code file comprises several steps (see Figure 1). These tools are involved:

6 Pages