This preview shows page 1. Sign up to view the full content.
Unformatted text preview: e in yet another section. To build the executable, the linker must perform two main tasks: 352
main.c Translators (cpp, cc1, as) main.o Linker (ld) p swap.c Translators (cpp, cc1, as) swap.o CHAPTER 7. LINKING
source files relocatable object files fully linked executable object file Figure 7.2: Static linking. The linker combines relocatable object ﬁles to form an executable object ﬁle p. ¯ ¯ Symbol resolution. Object ﬁles deﬁne and reference symbols. The purpose of symbol resolution is to associate each symbol reference with exactly one symbol deﬁnition. Relocation. Compilers and assemblers generate code and data sections that start at address zero. The linker relocates these sections by associating a memory location with each symbol deﬁnition, and then modifying all of the references to those symbols so that they point to this memory location. The following sections describe these tasks in more detail. As you read, keep in mind the basic facts of linkers: Object ﬁles are merely collections of blocks of bytes. Some of these blocks contain program code, others...
View Full Document
- Spring '10
- The American