11-03-2014, 02:57 PM
Loaders and Linkers
Loaders and Linkers.ppt (Size: 103.5 KB / Downloads: 182)
Introduction
To execute an object program, we needs
Relocation, which modifies the object program so that it can be loaded at an address different from the location originally specified
Linking, which combines two or more separate object programs and supplies the information needed to allow references between them
Loading and Allocation, which allocates memory location and brings the object program into memory for execution
Assemble-and-go Loader
Characteristic
the object code is stored in memory after assembly
single JUMP instruction
Advantage
simple, developing environment
Disadvantage
whenever the assembly program is to be executed, it has to be assembled again
programs have to be coded in the same language
Object Code Representation
Figure 3.1 (a)
each byte of assembled code is given using its hexadecimal representation in character form
easy to read by human beings
In general
each byte of object code is stored as a single byte
most machine store object programs in a binary form
we must be sure that our file and device conventions do not cause some of the program bytes to be interpreted as control characters
A Simple Bootstrap Loader
Bootstrap Loader
When a computer is first tuned on or restarted, a special type of absolute loader, called bootstrap loader is executed
This bootstrap loads the first program to be run by the computer -- usually an operating system
Example (SIC bootstrap loader)
The bootstrap itself begins at address 0
It loads the OS starting address 0x80
No header record or control information, the object code is consecutive bytes of memory
Improve Efficiency
Use local searching instead of multiple searches of ESTAB for the same symbol
assign a reference number to each external symbol
the reference number is used in Modification records
Implementation
01: control section name
other: external reference symbols
Example
Fig. 3.12