Chapter Three
Chapter Three
Walelign A. (M.Sc.)
January 4, 2021
Absolute loader
Bootstrap loader
Relocating loader (relative loader)
Design Options
Linking Loader
Linkage editors
Dynamic linking
Basic Loader Functions
The most fundamental functions of a loader:
:Bringing an object program into memory and starting its execution
In a Single Pass
I Check the Header record for program name, starting address, and
length
I Bring the object program contained in the Text record to the indicated
address
I No need to perform program linking and relocation
I Start the execution by jumping to the address specified in the End
record
In a Single Pass
I Object Program Contains
F H record
F T record
F E record
Bootstrap Loader
I When a computer is first turned on or restarted, a special type of
absolute loader, called a bootstrap loader is executed
In PC, BIOS acts as a bootstrap loader
I This bootstrap loads the first program to be run by the computer –
usually an operating system
I It then jumps to the just loaded program to execute it.
I Normally, the just loaded program is very small (e.g., a disk sector’s
size, 512 bytes) and is a loader itself.
I The just loaded loader will continue to load another larger loader and
jump to it.
I This process repeats another until the entire large operating system is
loaded.
In SIC/XE
I Relative and immediate addressing
Do not need to modify their object code after relocation
I Extended format
Whose values are affected by relocation
Need to modify when relocation
In SIC
I Format 3 with address field
Should be modified
SIC does not support PC-relative and base-relative addressing
Loaders that allow for program relocation are called relocating loaders
or relative loaders.
Two methods for specifying relocation as part of the object program
I Modification Records
F Suitable for a small number of relocations required
When relative or immediate addressing modes are extensively used
I Relocation bits
F Suitable for a large number of relocations required
When only direct addressing mode can be used in a machine with fixed
instruction format (e.g., the standard SIC machine)
A Modification record is used to describe each part of the object
code that must be changed when the program is relocated.
Pass 1
I Assign addresses to all external symbols
F Loader is concerned only with Header and Define records in the control
sections
I To build up ESTAB
F Add control section name into ESTAB
F Add all external symbols in the Define record into ESTAB
Pass 2
I Perform the actual loading, relocation, and linking
I When Text record is encountered
F Read into the specified address (+CSADDR)
I When Modification record is encountered
F Lookup the symbol in ESTAB
F This value is then added to or subtracted from the indicated location in
memory
Linkage Editor
The difference between a linkage editor and a linking loader:
I A linking loader performs all linking and relocation operations,
including automatic library search, and loads the linked program into
memory for execution.
I A linkage editor produces a linked version of the program, which is
normally written to a file for later execution.
Question
Many Thanks!