Linking Flashcards
.text
The machine code of the compiled program, stores function defs.
.rodata
Read only data, eg string constants in formatting strings, jump tables
.data
INITIALIZED global and static C variables
.bss
UN-INITIALIZED global and static C variables, values are allocated at runtime (“better save space”) that can be inited to zero (not pointers or structs)
.symtab
symbol table, info about functions and global vars.
.rel.text
A list of locations in the .text section that will need to be modified by the linker.
.rel.data
relocation information for any global variables, that will need to be modified by the linker.
.line
a mapping between source code and asm
.strtab
string table for the symbol table in the .symtable and .debug.
.debug
symbol table use to recover information about local vars and types defs for debugging purposes.
Global Symbols
Symbols that can be referenced by other modules. non-static C functions and Global Vars.
External Symbols
Global variables that are defined by “another” module
Local Symbols
Functions and Globals var declared with STATIC. cannot be seem by other modules.
COMMON
stores info about UN-INITIALIZED global vars
Strong Symbol
function, or inited global var
Weak Symbol
global Symbol that is un-initialized
Resolve multiple strong symbols
Error. this cannot be done
resolve multiple weak symbols
choose one arbitrarily
resolve weak and strong symbol
choose the strong symbol
Relocation Sections and Symbol definitions
1st step relocation. Linker merges all sections of the same type into a new aggregate section of the same type. then, run time memory addresses are assigned, each instr and global var has a unique address
Relocating Symbol references within sections
linker modifies symbols in the code and data sections so that then now point to the correct runtime address