Linking Cont. Flashcards
The ____, copies the code and data in the executable file prog into memory, then transfers control to the beginning of the program
Loader
_____ _____ take as inpout a collection of relocatable object files and command-line arguments and generate as output a fully linked executable object file that can be loaded and run. The input relocatable object file consists of various code and data sections, were each section is a contiguous sequence of bytes. Instructions are in on section, initialized global variables in other, initialized variables are in yet another section
Static linkers
To build and executable, the linker must perform two main tasks:
- Symbol resolution
- Relocation
The purpose of _______is to associate each symbol references with exactly once symbol definition
Symbol resolution
Compilers and assembler generate code and data section that start at address 0. The linker relocates these sections by associating a memory location with each symbol definition, and then modifying all the references to those symbols sot that they point to this memory location.
Relocation
Object files come in three forms
- Relocatable object file
- Executable object file
- Shared object file
Contains binary code and data in a form that can be combined with other relocatable object files at compile time to create an executable object file
Relocatable object file
Contains binary code and data that can be coped directly into memory and executed
Executable objet file
A special type of relocatable object file that can be loaded int memory and linked dynamically, at either load time or run time
Shared object file
The ____ header begin with a 16 byte sequence that describes the word size and byte order of the system that generated the file
ELF
Sandwiched between the ELF header and the section header table are the _____ themselves
Sections
The machine code of compiled program
.text
The read only data such as format string in print statement and jump tables for switch statements
.rodata
Initialize global and static C variables. Local c variables are maintained at run time on the stack and do not appear in the .data or .bss sections
.data
Unitiliaze global and static C variables along with any global or static variables that are initialized to 0
.bss