The GNU Compiler Collection ( otherwise known as GCC) is a compiler and set of utilities to build binaries from high-level source code. GCC is not only the de facto standard compiler on GNU/Linux, but it s also the standard for embedded systems development. This is because GCC supports so many different target architectures. For example, our use here will concentrate on host-based development (building software for the platform on which we re compiling), but if we were cross compiling (building for a different target) then GCC provides for 40 different architecture families. Examples include 86, RS6000, Arm, PowerPC, and many others. GCC can also be used on over 40 different host systems (such as Linux, Solaris, Windows, or the Next operating system).
GCC also supports a number of other languages, outside of standard C. We could compile for C++, Ada, Java, Objective-C, FORTRAN, Pascal, and three dialects of the C language.
In this chapter, we ll look at some of the basic features of GCC and some of the more advanced ones (including optimization). We ll also look at some of the related tools within GCC that are useful in image construction (such as size , objcopy , and others).
Note | We ll address the 3.2.2 version of GCC in this chapter. This is the default version for Red Hat 9.0. Newer versions of GCC now exist, but the details explored here remain compatible. |