What is a Toolchain?
A toolchain means the collection of programs used for compiling and linking an application. It consists of three separate components: binutils, libraries and compiler. This article introduces these components.
Binutils
A binutils (binary utilities) project implements the job of manipulating files in a way that's appropriate for the target machine. It embodies the Key parts of the toolchain such as the linker and the assembler.
Binutils contains the following programs:
* ar: creates, modifies, and extracts from archives
* nm: lists the symbols from object files. If no object files are listed as arguments, nm assumes the file a.out
* objcopy: copies the contents of an object file to another.
* objdump/readelf: reads and prints out information from a binary file. readelf performs the same function; however, it can work only with ELF-formatted files.
* ranlib: generates an index to the contents of an archive and stores it in the archive.
* size: prints out the size of various components of a binary file.
* strings: extracts the strings from a binary, performing correct target host byte order translation. It's frequently used as the slacker's way of seeing what libraries a binary links to, as ldd doesn't work for cross-compiled programs: strings | grep lib.
* strip: discards all symbols from object files
* c++filt: does the inverse mapping: it decodes (demangles) low-level names into user-level names so that they can be read.
* addr2line: gives a binary with debugging information and an address, returns the line and file of that address.
* nlmconv: converts an object file into a Netware Loadable Module (NLM).
* gprof: produces reports based on data collected when running code with profiling enabled.
See GUN Binutils for example.
C Library
A C standard library is a now-standardized collection of header files and library routines used to implement common operations, such as input/output and string handling, in the C programming language. It supplies much of the code in a C language based project. By picking a well designed library we can greatly reduce the hardness of programming as well as the size of the project.
Click here to see The C Library Reference Guide
The table below lists the pros and cons of some commonly used C libraries:
| Library | Pros | Cons |
| glibc | The canonical C library; contains the greatest amount of support for all C features; very portable; support for the widest number of architectures. | Size; configurability; can be hard to cross-build. |
| uClibc | Small (but not the smallest); very configurable; widely used; active development team and community | Not well supported on all architectures; handles only UTF-8 multibyte characters. |
| DietLibC | Small, small, small; excellent support for ARM and MIPS. | Least functionality; no dynamic linking; documentation. |
| NewLib | Well supported by Red Hat; best support for math functions; great documentation. | Smallish community; not updated frequently. |
Preprocessor and Compiler
The preprocessor and the compiler perform only a small slice of the work that is necessary for producing an executable file. The preprocessor runs before the compiler to modify your program according to the preprocessor directives(such as #define) in your source code. The compiler transforms the source code into object code and generates object file. If it is an executable binary file that the user wants to produce, the object file is then passed to the linker and produced as executable file.