Real-Time Systems Development

17.4: The gcc compilation process

17.4 The gcc compilation process

Gcc by itself only compiles the C or C++ code into assembler. Normally gcc assumes responsibility for invoking all the passes required for a complete build. These are: cpp, cc1, gas, and ld. Where cpp is the C preprocessor, which merges all the required include files, expands all macro definitions, and processes all the #ifdef conditional sections. To see the output of ccp, invoke gcc with the -E option, and the preprocessed file will be displayed. The actual compiler is cc1, which produces assembler code from the preprocessed source file. In fact, gcc is really only a driver program to evoke all the compiler passes. Although it is seen as a compiler command line, gcc will deal with command-line options intended for any of the other passes. The usual gcc command line will ask ld to link in the necessary startup code and additional libraries by default.


The GNU compiler suite

GNU gas started its life as a single phase within the compiling operation, but now it can also be used as a stand-alone, source-level assembler. When used as a source-level assembler, it has a companion assembler preprocessor called gasp. This has a syntax similar to most other assembler macro packages. Gas generates a relocatable object file from the assembler source.

The linker, ld, is responsible for resolving the values of logical symbols and addresses, swapping numbers for the symbols, by using the symbol table. Some RTEs use relocatable object file formats like...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Programming Languages
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.