
CS485G Spring 2015 36
(d) Windows calls shared object files Dynamic Link Libraries (DLLs).
7. Lecture 21, 3/23/2015
8. Relocation
(a) The linker combines the object files into a single file.
(b) All text segments are placed together; similarly for other seg-
ment types.
(c) The linker relocates global identifiers exported from each ob-
ject file to account for the space occupied by the identifiers in
previous object files in its list.
(d) The linker updates all references to relocated global identifiers.
38 Format for object files
1. Since about 1990, Unix variants have standardized to a single format
for object files: Executable and Linkable Format (ELF).
2. ELF format applies to relocatable object files, executable object files,
and shared object files; together, we call them ELF binaries.
3. Sections of an ELF file.
(a) header: word size, byte ordering, object-file type, architecture
(b) segment header table page size, segment sizes.
(c) code (.text section)
(d) read-only data, such as jump tables (.rodata section)
(e) initialized global variables (.data section)
(f) uninitialized global variables (.bss section): only length, no
content. “bss” stands for “block started by symbol”.
(g) symbol table (.symtab section), including procedures and static
variables, section names, each with location.
(h) text relocation table (.rel.text section): addresses in .text
that need to be modified for relocation and how to relocate them.
(i) data relocation table (.rel.data section): addresses in .data
that need to be modified for relocation and how to relocate them.
(j) debugging information (.debug section), produced, for instance,
with gcc -g.
(k) section header table: offsets and sizes of each section
Comentarios a estos manuales