This preview shows page 1. Sign up to view the full content.
Unformatted text preview: al, global, or extern) and the section (.text, .data, or .bss) it occupies in that module. Symbol buf bufp0 bufp1 swap temp swap.o .symtab entry? Symbol type Module where deﬁned Section 7.6 Symbol Resolution
The linker resolves symbol references by associating each reference with exactly one symbol deﬁnition from the symbol tables of its input relocatable object ﬁles. Symbol resolution is straightforward for references to local symbols that are deﬁned in the same module as the reference. The compiler allows only one deﬁnition of each local symbol per module. The compiler also ensures that static local variables, which get local linker symbols, have unique names. However, resolving references to global symbols is trickier. When the compiler encounters a symbol (either a variable or function name) that is not deﬁned in the current module, it assumes that it is deﬁned in some other module, generates a linker symbol table entry, and leaves it for the linker to handle. If the linker is unable to ﬁnd a deﬁnition for the referenced symbol in any of its input modules, it prints an (often cryptic) error message and terminates. For example...
View Full Document
- Spring '10
- The American