Linking Flashcards
The process of collecting and combining various pieces of code and data into a single file that can be loaded (coped) into memory and executed
Linking
The process of adjusting addresses in object modules when modules are linked with other modules to create and executable
Relocation
When can linking be dome
Compile time
Load time
Run time
Programs are translated and linked using a ______ ______
Compile driver
First reason why linkers are useful
Modularity: program can be written as a collection of smaller source files rather than one monolithic mass
Can build libraries of common functions
What do linkers do?
Step 1: symbol resolution
Symbol definitions are stored in object file in a _____ ____
Symbol table
Symbol table is an ______ of ____
Array, structs
What is the next step of linking
Relocation
Relocation merges separate code and data sections into _____ sections
Single
Contains code and data in a form that can be combined with other relocatable object files to form executable object file
Relocatable object file
Contains code and data in a form that can be copied directly into memory and then executed
Executable object file
Special type of relocatable object file that can be loaded into memory and linked dynamically either load time or run time
Shared object file
ELF
Executable and Linkable Format
Word size, byte ordering, file type, machine type, etc
Elf header
Page size, virtual address memory segments, segments sizes
Segments header table
Code
.text section
Read only data: jump tables, ….
.rodata section
Unitialized global variables
.bss section
Symbols defined by module m that can be referenced by other modules
File cope (global) symbols
Fil;e scope symbols that are referenced by module m buy defined by some other module
External symbols
Symbols that are defined and referenced exclusively my module m
Local symbols
Local linker symbols are not block scope variables
Local non-static c-variables:
Stored on the stack
Local static C variables:
Stored in either .bss or .data