C12 Assembly and Linking
At the end of the actual compilation process, the original C program has been translated into assembler code, and the final steps along the path to binary code require little compiler effort because the assembler and linker (often referred to as the "binder") do the rest of the work.
As compared to the task of the compiler, the work of the assembler is very simple. The individual assembler statements (and their arguments) are translated into a special binary format that differs according to processor type (each assembler command has its own binary code notation; on some systems, such as IA-32, different binary forms may be available for a command depending on the argument types used). A further task of the assembler is to accommodate constant data (such as fixed strings or numeric constants) in the binary code. Usually the ELF format (described at length in Appendix E) is employed to arrange the program and data in a binary file.
The linker must (among other things) adjust the branch addresses in the assembler code. Although the assembler source text can still reference symbolic names (for example, the preceding assembler code uses calls to the printf function defined in the standard library), the binary variant must specify relative or absolute branch addresses; for instance, "skip the next 5 bytes" or "branch to position x").
Continue reading here: C13 Procedure Calls
Was this article helpful?