Linker and Loader
Linker and Loader
Linker and Loader
Submitted to:
Ramakrishna
Asst. Prof.
Submitted by:
A. Sonu Devi
Ayush Upadhyay
Dipti Rani
Lincoln
Content
Introduction
Basic Loader Functions
Design of an Absolute Loader
Algorithm for an Absolute Loader
A Simple Bootstrap Loader
Machine-Dependent Loader Features
Relocating Loaders
Modification Record
Relocation Bit
Program Linking
Linking Loader
Algorithm and Data structures of a Linking Loader
Introduction
Absolute loader:
The
As
When
Absolute Program
Advantage
Disadvantage
Program Logic
Bootstrap Loader
Machine-Dependent Loader
Features
Relocation
Program linking
Linking loader
Relocating Loaders
Motivation
modification record
relocation bit
Modification Record
For complex machines
Also called RLD specification
Relocation
Modification record
col 1: M
col 2-7: relocation
address
col 8-9: length (halfbyte)
col 10: flag (+/-)
col 11-17: segment
name
Relocation Bit
Text record
col 1: T
col 2-7: starting address
col 8-9: length (byte)
col 10-12: relocation bits
col 13-72: object code
Program Linking
Goal
Resolve the problems with EXTREF and EXTDEF from different control
sections
Linking
1.
Example
address constant
external reference
Expression
REF1 LISTA
Program A
Program B
Program C
LISTA, ENDA LISTB, ENDB LISTC, ENDC
local, R, PC
external
external
REF2 LISTB+4
external
local, R, PC
external
REF3 ENDA-LISTA
local, A
external
external
REF4 ENDA-LISTA+LISTC
local, A
external
local, R
REF5 ENDC-LISTC-10
external
external
local, A
REF6 ENDC-LISTC+LISTA-1
local, R
external
local, A
REF7 ENDA-LISTA-(ENDB-LISTB)
REF8 LISTB-LISTA
local, A
local, R
local, A
local, R
external
external
Linking Loader
Linking Loader
Linking Loader
Modification record:
.
Two passes:
In Pass 1:
In pass 2:
May print a load map for all control sessions and symbols, useful in program debugging
Actually loading, relocation, and linking
CSADDR is used as in Pass 1
For each Text record, the object code is placed to the address (=the address in the
instruction + CSADDR).
For each Modification record, from the name, looking for ESTAB to get the address (in
another control session), then add or subtract from the indicated location.
THANK YOU