Sie sind auf Seite 1von 50

Unit – 5

Linkers and Loaders


Gopi Sanghani
 9825621471
 gopi.sanghani@darshan.ac.in
System
System Programming
Programming (2150708)
(2150708) Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Topics to be covered
 Introduction
 Relocation of Linking Concept
 Design of a Linker
 Self-Relocating Programs
 Linking in MSDOS
 Linking of Overlay Structured Programs
 Dynamic Linking, Loaders, Different Loading Schemes, Sequential
and Direct Loaders, Compile-and-Go Loaders, General Loader
Schemes, Absolute Loaders, Relocating Loaders, Practical
Relocating Loaders, Linking Loaders, Relocating Linking Loaders,
Linkers v/s Loaders

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 22 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
GTU Questions
 What is program relocation? How relocation is performed by
linker? Explain with example. OR Explain Self relocating program
 Explain Absolute Loader with example.
 What is overlay? Explain linking of overlay structured program.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 33 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Introduction - Linker
 The linker is a system program that combines the code of a target
program with codes of other programs and library routines.

 Language translator builds an object module for a program which


contains,

Information about other


Target Code of
program + programs and library
routines needed to invoke
during execution

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 44 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Introduction - Linker
 The Linker
• Extracts this information from the object module
• Locates the needed programs and routines
• Combines them with the target code of the program
• Produces an executable program in machine (binary) language

 The loader is a system program that loads binary program in


memory for execution.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 55 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Schematic of program’s execution
 Execution of a program is achieved through four steps:
(1) Translation (2) Linking (3) Relocation and (4) Loading

Source Data
Program

Binary
Translator Linker Loader Result
Program

Object Binary
module Programs

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 66 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Introduction - Linker
 Translation time address: Translation time address is used at the
translation time. This address is assigned by translator.

 Linked time address: Link time address is used at the link time.
This address is assigned by linker.

 Load time address: Load time address is used at the load time.
This address is assigned by loader

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 77 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Introduction - Linker
 Translated origin: Address of origin assumed by the translator
(address specified in ORIGIN or START or default).

 Linked origin: Address of origin assumed by the linker while


producing a binary program.

 Load origin: Address of origin assumed by the loader while loading


the program for execution.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 88 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Relocation and Linking Concept
 Let AA be the set of absolute addresses - instruction or data
addresses – used in the instruction of a program P.

 AA ≠ ф implies that program P assumes its instructions and data to


occupy memory words with specific addresses.

 Such a program – called an address sensitive program – contains


one or more of the following:
• An address sensitive instruction: an instruction which uses an address αi
included in set AA.
• An address constant: a data word which contains an address αi ϵ AA.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 99 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Relocation and Linking Concept
 An address sensitive program P can be executed correctly only if
the start address of the memory area allocated to it is the same as
its translated origin.

 To execute correctly from any other memory area, the address


used in each address sensitive instruction of P must be ‘corrected’.

 It is achieved through program relocation.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 10
10 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Program Relocation
 Program relocation is the process of modifying the addresses used
in the address sensitive instructions of a program such that the
program can execute correctly from the designated area of
memory.

 If linked origin ≠ translated origin, relocation must be performed


by the linker.

 If load origin ≠ linked origin, relocation must be performed by the


loader.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 11
11 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Performing relocation
 Let the translated and linked origins of program P be t_originp and
l_originp, respectively.

 Consider a symbol symb in P.

 Let its translation time address be tsymb and link time address be
lsymb.

 The relocation factor of P is defined as


Relocation _factorp = l_originp - t_originp
 Note that relocation_factorp can be positive, negative or zero.
Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 12
12 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Performing relocation
 Consider a statement which uses symb as an operand.
 The translator puts the address tsymb in the instruction generated
for it.
 Now,
tsymb = t_originp + dsymb
 Where dsymb is the offset of symb in P.
 Hence,
lsymb = l_originp + dsymb
lsymb = t_originp + Relocation_factorp + dsymb
= t_originp + dsymb + Relocation_factorp

lsymb = tsymb + Relocation_factorp

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 13
13 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
RELOCATION EXAMPLE

• If the program is loaded for execution in the memory area


starting with the address 900, its load time origin would be 900.
• The load time address of LOOP would be 901.
• The address of A would be 940.
• Relocation factor = 900 – 500 = 400

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 14
14 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Linking
 Consider an application program AP consisting of a set of program
units SP = {Pi}.
 A program unit Pi interacts with another program unit Pj by using
addresses of Pj’s instructions and data in its own instructions.
 To realize such interactions, Pj and Pi must contain public
definitions and external references as defined in the following:
• Public definition: a symbol pub_symb defined in a program unit which may
be referenced in other program units.
• External reference: a reference to a symbol ext_symb which is not defined
in the program unit.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 15
15 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Linking
 EXTRN AND ENTRY statements
• An ENTRY statement in a program unit lists the public definitions of the
program unit.
• An EXTRN statement lists the symbols to which external references are
made in the program unit.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 16
16 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Linking
 Linking is the action of putting the correct linked addresses in those
instructions of a program that contain external references.

 Object module contains all the information that would be needed to


relocate and link the program unit with other program units.

 The object module consists of,


• Header contains translated origin, size and execution start address
• Program contains the machine language program
• Relocation table describes the instructions that require relocation. Each
RELOCTAB entry contains a single field – translated address.
• Linking table contains information about the public definitions and external
references. Each LINKTAB entry contains – symbol, type and translated address.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 17
17 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Design of a Linker
 The design of linker is divided into two parts:
1. Relocation: allocate space in memory for the programs
2. Linking:
• Resolve symbolic references between object files
• combines two or more separate object programs
• supplies the information needed to allow references between them

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 18
18 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Algorithm: Program Relocation
1. program_linked_origin := <link origin> from the linker command;
2. For each object module mentioned in the linker command
a. t_origin := translated origin of the object module;
b. OMsize := size of the object module;
c. relocation_factor := program_linked_origin – t_origin;
d. Read the machine language program contained in the program component
of the object module into the work-area.
e. Read RELOCTAB of the object module.
f. For each entry in RELOCTAB,
i. translated_address := address found in the RELOCTAB entry;
ii. address_in_work_area := address of work_area + translated_address –
t_origin;,
iii. Add relocation-factor to the operand address found in the word that has the
address address_in_work_area.
g. Program_linked_origin := program_linked_origin + OM_size;

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 19
19 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Algorithm: Program Linking
1. program_linked_origin := <link origin> from the linker command.
2. For each object module mentioned in the linker command
a. t_origin := translated origin of the object module;
b. OM_size := size of the object module;
c. relocation_factor := program_linked_origin – t_origin;
d. Read the machine language program contained in the program
component of the object module into the work_area.
e. Read LINKTAB of the object module.
f. Enter (object module name, program_linked_origin) in NTAB.
g. For each LINKTAB entry with type = PD
i. name := symbol field of the LINKTAB entry;
ii. linked_address := translated_address + relocation_factor;
iii. Enter (name, linked_address) in a new entry of the NTAB.
h. program_linked_origin := program_linked_origin + OM_size;

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 20
20 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Algorithm: Program Linking
3. For each object module mentioned in the linker command
a. t_origin := translated origin of the object module;
b. program_linked_origin := linked_adress from NTAB;
c. For each LINKTAB entry with type = EXT
i. address_in_work_area := address of work_area + program_linked_origin -
<link origin> in linker command + translated address – t_origin;
ii. Search the symbol found in the symbol field of the LINKTAB entry in NTAB and
note its linked address. Copy this address into the operand address field in the
word that has the address address_in_work_area.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 21
21 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
STATEMENTS
Example
ADD M/C CODE

ORIGIN 500
READ A 500 09 0 540
LOOP …. 501
. . . .
. . . .
A DS 1 540 SYMBOL LINKED
ADDRESS
541
P 900
A 940
STATEMENTS ADD M/C CODE
Q 942
START 200 ALPHA 973
ENTRY ALPHA
. . . .
ALPHA DS 25 231

END LINKER 900, P, Q

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 22
22 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Self-Relocating Programs
 Programs can be classified as,
1. A non-relocatable program
2. A relocatable program
3. A Self-relocatable program

 A self relocating program is a program which can perform its own


relocation of address sensitive instructions.
 It contains following two provisions for this purpose:
• A table of information concerning the address sensitive instructions exists
as a part of the program.
• Code to perform the relocation of address sensitive instructions also exists
as a part of the program. This is called the relocating logic.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 23
23 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Self-Relocating Programs
 The start address of the relocating logic is specified as the execution start address of
the program.

 Thus the relocating logic gains control when the program is loaded in memory for the
execution.

 It uses the load address and the information concerning address sensitive instructions
to perform its own relocation.

 Execution control is now transferred to the relocated program.

 A self –relocating program can execute in any area of the memory.

 This is very important in time sharing operating systems where the load address of a
program is likely to be different for different executions.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 24
24 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Linking of Overlay Structured Programs
 An overlay is part of a program (or software package) which has
the same load origin as some other part of the program.

 Overlay is used to reduce the main memory requirement of a


program.

 We refer to a program containing overlays as an overlay structured


program. Such a program consists of
• A permanently resident portion, called the root.
• A set of overlays.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 25
25 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Execution of Overlay structured programs
 Execution of an overlay structured program proceeds as follows:
• To start with, the root is loaded in memory and given control for the
purpose of execution.
• Other overlays are loaded as and when needed.
• The loading of an overlay overwrites a previously loaded overlay with the
same load origin.

 This reduces the memory requirement of a program.

 It also makes it possible to execute programs whose size exceeds


the amount of memory which can be allocated to them.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 26
26 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Execution of Overlay structured programs
 The overlay structure of a program is designed by identifying
mutually exclusive modules that is, modules which do not call
each other.

 Such modules do not need to reside simultaneously in memory.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 27
27 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Execution of an overlay structured program
 For linking and execution of an overlay structured program in MS
DOS, the linker produces a single executable file at the output,
which contains two provisions to support overlays.
• First, an overlay manager module is included in the executable file.
• This module is responsible for loading the overlays when needed.
• Second, all calls that cross overlay boundaries are replaced by an interrupt
producing instruction.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 28
28 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Execution of an overlay structured program
 The overlay manager receives control and loads the root.

 A procedure call which crosses overlay boundaries leads to an


interrupt.

 This interrupt is processed by the overlay manager and the


appropriate overlay is loaded into memory.

 Control is now transferred to the OS loader to load the


appropriate binary program.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 29
29 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Static Linking
 In static linking, the liner links all modules of a program before its
execution begins; it produces a binary program that does not
contain any unresolved external references.

 If statically linked programs use the same module from a library,


each program will get a private copy of the module.

 If many programs that use the module are in execution at the


same time, many copies of the module might be present in
memory.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 30
30 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Dynamic Linking
 Dynamic linking is performed during execution of a binary program.

 The linker is invoked when an unresolved external reference is


encountered during execution of the program.

 This arrangement has several benefits concerning use, sharing and


updating of library modules.

 If the module referenced by a program has already been linked to


another program that is in execution, a copy of the module would
exist in memory. The same copy of the module could be lined to his
program as well, thus saving memory.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 31
31 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Dynamic Linking
 To facilitate dynamic linking, each program is first processed by
the static linker.

 The static linker links each external reference in the program to a


dummy module whose only function is to call the dynamic linker
and pass the name of the external symbol to it.

 Hence, the dynamic linker would be activated only when an


external reference is identified during execution.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 32
32 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Loader Introduction
 The loader is responsible for the activities such as allocation,
linking, relocation and loading.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 33
33 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Different Loading Schemes
 Different Loading Schemes are,
• Compile-and-Go Loaders
• General Loader Schemes
• Absolute Loaders
• Relocating Loaders
• Linking Loaders
• Relocating Linking Loaders

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 34
34 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Compile-and-Go Loaders
 In this type of loader, the instruction is read line by line, its machine
code is obtained and it is directly put in the main memory at some
known address.

 That means the assembler runs in one part of memory and the
assembled machine instructions and data directly put into their
assigned memory locations.

 After the completion of loading process, the assembler transfers the


control to the starting instruction of the loaded program.

 This loading scheme is also called as “assemble and go”.


Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 35
35 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Compile-and-Go Loaders
 The typical example is WATFOR-77, it’s a FORTRAN compiler which
uses such “load and go” scheme.

 Advantages
• No additional routines are required to load the compiled code into memory.
• Execution speed is generally much superior to interpreted systems.
• They are simple and easier to implement.

 Disadvantages
• There is wastage in memory space due to the presence of the assembler.
• The code must be re-assembled every time it is run.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 36
36 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Compile-and-Go Loaders

Compile & go
Loader
Source Compiler & go
program assembler

Executable code

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 37
37 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
General Loader Schemes
 The general loading scheme improves the compile/assemble-and-
go scheme by allowing different source programs (or modules of
the same program) to be translated separately into their
respective object programs.

 The object code (modules) is stored in the secondary storage area;


and then, they are loaded.

 The loader usually combines the object codes and executes them
by loading them into the memory, including the space where the
assembler had been in the assemble-and-go scheme.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 38
38 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
General Loader Schemes
 Rather than the entire assembler sitting in the memory, a small
utility component called loader does the job.

 Advantages of the general loading scheme:


• Saves memory and makes it available for the user program as loaders are
smaller in size than assemblers. The loader replaces the assembler.

• Reassembly of the program is no more needed for later execution of the


program. The object file is available and can be loaded and executed directly
at the desired location.

• This scheme allows use of subroutines in several different languages because


the object files processed by the loader utility will all be in machine
language.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 39
39 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
General Loader Schemes
 Disadvantages of the general loading scheme:
• The loader is more complicated and needs to manage multiple object files.
• Secondary storage is required to store object files, and they cannot be
directly placed into the memory by assemblers.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 40
40 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Absolute Loaders
 An absolute loader loads a binary program in memory for
execution.

 The binary program is stored in a file contains the following:


 A Header record showing the load origin, length and load time
execution start address of the program.

 A sequence of binary image records containing the program’s


code. Each binary image record contains a part of the program’s
code in the form of a sequence of bytes, the load address of the
first byte of this code and a count of the number of bytes of code.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 41
41 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Absolute Loaders
 The absolute loader notes the load origin and the length of the
program mentioned in the header record.

 It then enters a loop that reads a binary image record and moves
the code contained in it to the memory area starting on the
address mentioned in the binary image record.

 At the end, it transfers control to the execution start address of


the program.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 42
42 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Absolute Loaders

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 43
43 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Absolute Loaders
Advantages Disadvantages

Simple to implement and efficient in The programmer must know and


execution. clearly specify to the translator (the
assembler) the address in the
memory for linking and loading of
Saves the memory (core) because the the programs. Care should be taken
size of the loader is smaller than that so that the addresses do not overlap.
of the assembler.

Allows use of multi-source programs For programs with multiple


written in different languages. In subroutines, the programmer must
such cases, the assembler converts remember the absolute address of
the source program into the given each subroutine and use it explicitly
language, and a common object file in other subroutines to perform
is then prepared by address linking.
resolution.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 44
44 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Absolute Loaders
Advantages Disadvantages

The loader is simpler and just obeys If the subroutine is modified, the
the instruction regarding where to program has to be assembled again
place the object code in the main from first to last.
memory.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 45
45 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Relocating Loaders
 A relocating loader loads a program in a designated area of
memory, relocates it so that it can execute correctly in that area of
memory and passes control to it for execution.

 The binary program is stored in a file contains the following:


• A Header record showing the load origin, length and load time execution
start address of the program.
• A sequence of binary image records containing the program’s code. Each
binary image record contains a part of the program’s code in the form of a
sequence of bytes, the load address of the first byte of this code and a
count of the number of bytes of code.
• A table analogous to RELOCTAB table giving linked addresses of address
sensitive instructions in the program.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 46
46 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Practical Relocating Loaders
 To avoid possible assembling of all subroutine when a single
subroutine is changed and to perform task of allocation and
linking for the programmer, the general class of relocating loader
was introduced.

 Binary symbolic loader (BSS) is an example of relocating loader.

 The output of assembler using BSS loader is


• Object program.
• Reference about other program to be accessed.
• Information about address sensitive entities.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 47
47 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Linking Loaders
 A modern program comprises several procedures or subroutines together with
the main program module.

 The translator, in such cases as a compiler, will translate them all


independently into distinct object modules usually stored in the secondary
memory.

 Execution of the program in such cases is performed by linking together these


independent object modules and loading them into the main memory. Linking
of various object modules is done by the linker.

 Special system program called linking loader gathers various object modules,
links them together to produce single executable binary program and loads
them into the memory.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 48
48 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Linking Loaders
 This category of loaders leads to a popular class of loaders called
direct-linking loaders.

 These linking loaders, which link the necessary library functions


and symbolic references.

 Essentially, linking loaders accept and link together a set of object


programs and a single file to load them into the core.

 Linking loaders additionally perform relocation and overcome


disadvantages of other loading schemes.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 49
49 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Relocating Linking Loaders
 Relocating linking loaders combines together the relocating capabilities of
relocating loaders and the advanced linking features of linking loaders and
presents a more robust loading scheme.

 This necessarily eliminates the need to use two separate programs for linking and
loading respectively.

 These loaders can perform relocation and linking both.

 These types of loaders are especially useful in dynamic runtime environment,


where the link and load origins are highly dependent upon the runtime situations.

 These loaders can work efficiently with support from the operating system and
utilize the memory and other resources efficiently.

Unit
Unit –– 5:
5: Linkers
Linkers and
and Loaders
Loaders 50
50 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology

Das könnte Ihnen auch gefallen