Example, Showing Entries in Different Databases: Relocatable
Example, Showing Entries in Different Databases: Relocatable
segment.
which defined in the
3 The list of all the symbols are
segments.
26.8.1 BasicBlocks
Functions of Loader
Functions of Loader
i. Allocation
ii. Linkinng
ii. Relocation
iv. Loading
i) Allocation
Allocates memory space for program.
i ) Linking
Binding of object program code with necessary library
routines or other object program codes to generate
executable program code.
(lii) Relocation
GQ. What isa basic block and flow graph? Generate t1:=4
three address code for the following program. Find t2: a [t1j
the basic blocks in it and write flow graph for the t3: 4 * i
same (8 Marks) t4: b [t3]
15: t 2 t4
begin t6:= prod +t5
prod 0;
prod=t6B
i : 1; t7:i+ 1
do i =t7
begin if i< 20 goto B2
prod= prod +ali] * b[il:
i:=i+1;
end (1E1)Fig. 6.8.1: Flow graph for dot product program
while i <=20
6.8.4 Representation of Basic Blocks
end
Basic block can be represented by a record consisting
Flow graph is a directed graph used to add flow-of
of a count of the number of quadruples in the block followeu
control information to the set of basic blocks making
or
by a pointer to the leader of the block and by the lists
up a program.
"
predecessors and successors of the block as shown
Nodes are the basic blocks.
Fig. 6.8.1.
9
S y s t e mP r O g r a m m i n
Ua. Linking
Compare Lin loaderand Linkage Editor.
are
***
-- --- MU-Dec. 18,5 Marks
Parameter
Linking Loader Linkage Editor
Performs all
linking and relocation operations, Produces a Linked version of the
F u n c t o n
program, which
including automatic library search, and loads thelis normally writen to a file or library for later
linked program into memory for execution.
execution.
Suitable for Suitable when a program is reassembled
for|Suitable when a program is executed many times
nearly every execution.
without being reassembled.
of
ecnlution
Reso
reference
eteriaResolution
of external reference and library Resolution of external reference and
library
ence and librarysearching is performed more than once.
and
searching is performed only once.
searching
finking operations|Linking loaders perform linking operations at|Linkage editors perform linking operations before
Linking
load time.
tume the program is loaded for execution
The relocating loader loads the load module into
Need of relocan8There is no need of relocating loader.
loader
the memory
Passes required The Loading may requires two passes. The Loading can be accomplished in one pass.
the program development is finished or|
Time of use When program is in development stage then at|.|When
when the library is built then linkage editor can be|
the linking loader be used.
that time can
used.
Diagram Object
program(s)
Object
program(s).
Linkage
Library editor
Linking
Library loader Linked
program
Memory
Relocating
loader
Loader
Fig. 4.8.1 : Linking
Memory
Chapter Ends..
(5) Relocating Loader (BSS)
known address.
After completion of assembly process, assembler
Assembler
t3= uminus c t4 b* 13
5 = t2 + t4 a = t5
(1) tl b 2
(2) uminus C t3
(3) t3 b t4
(4) + t2 t4 5
(5) t5 a
+
hatand Falllu laallM
1 E TE
F+TEE
T FT'
T E
T FTE
F E)id T
lauaid
E tE
t, 2,9
T,EP,$
F 1C,d , t,2,$
Dynamic Loading
It is necessary that the entire program and all data of a
to
process must be in physical memory for the process
execute.
dynamic loading.
O With dynamic loading, a routine is not loaded
until it is called.
format.
O The main program is loaded into memory and is
The
executed. When a routine needs to call another
routine, the calling routine first checks to see