SlideShare a Scribd company logo
8
Most read
16
Most read
17
Most read
Loaders and Linkers
 Name: Kunj Desai
 Branch: CSE A
 Semester: 5th
 Year: 2016
Translation Hierarchy
 Compiler : Translates high-level language program
into
assembly language.
 Assembler: Converts assembly language programs
into
object files.
 Object files contain a combination of machine
instructions, data, and information needed to place
instructions properly in memory.
Flow of the Hierarchy
Flow of Execution
Translator
Linker
Loader
Program
execution
.Obj
.exe
Process for producing an executable file
Explanation to Linker
 Definition: Tool that merges the object files produced by
separate compilation or assembly and creates an
executable file.
 Three tasks done by LINKER:
 Searches the program to find library routines used by
program, e.g. printf(),sqrt(),strcat() and various other.
 Determines the memory locations that code from each
module will occupy and relocates its instructions by
adjusting absolute references.
Explanation to Linker
 Relocation, which modifies the object program so
that it can be loaded at an address different from the
location originally specified.
It combines two or more separate object programs and
supplies the information needed to allow references
between them .
Linking Concepts
 Computer programs typically comprise several parts or modules; all these
parts/modules need not be contained within a single object file, and in such
case refer to each other by means of symbols. Typically, an object file can
contain three kinds of symbols:
 Publicly defined symbols, which allow it to be called by other modules , also
called as public definition .
 Externally defined symbols(undefined symbols), which calls the other
modules where these symbols are defined, also called as external reference.
 Local symbols, used internally within the object file to facilitate relocation.
Static Linking
 Static linking occurs when a calling program is linked to a
called program in a single executable module. When the
program is loaded, the operating system places into
memory a single file that contains the executable code
and data.
 The result of statically linking programs is an .EXE file or
dynamic link library (DLL) subprogram that contains the
executable code for multiple programs. This file includes
both the calling program and the called program.
Advantages and Disadvantages
 Advantages
 The advantage of static linking is that you can create self-
contained, independent programs. In other words, the
executable program consists of one part (the .EXE file)
that you need to keep track of.
 Disadvantages:
 You cannot change the behavior of executable files
without re-linking them.
 External called programs cannot be shared, requiring that
duplicate copies of programs be loaded in memory if
more than one calling program needs to access them.
Dynamic linking
 Many operating system environments allow dynamic
linking, that is the postponing of the resolving of some
undefined symbols until a program is run.
 That means that the executable code still contains
undefined symbols, plus a list of objects or libraries
that will provide definitions for these. Loading the
program will load these objects/libraries as well, and
perform a final linking.
Advantages
 Advantages :
 Often-used libraries (for example the standard system
libraries) need to be stored in only one location, not
duplicated in every single binary.
 If an error in a library function is corrected by
replacing the library, all programs using it dynamically
will benefit from the correction after restarting them.
Programs that included this function by static linking
would have to be re-linked first.
Disadvantages
 Disadvantages:
 Known on the Windows platform as "DLL Hell", an
incompatible updated DLL will break executables that
depended on the behavior of the previous DLL.
 A program, together with the libraries it uses, might be
certified (e.g. as to correctness, documentation
requirements, or performance) as a package, but not
if components can be replaced.
Definition of Loader
 Loader is utility program which takes object code as
input prepares it for execution and loads the
executable code into the memory. Thus loader is
actually responsible for initiating the execution
process.
 It is a SYSTEM PROGRAM that brings an executable
file residing on disk into memory and starts it running.
Functions of Loader
 The loader is responsible for the activities such as allocation, linking ,
relocation and loading:
1) It allocates the space for program in the memory, by calculating the
size of the program. This activity is called allocation.
2) It resolves the symbolic references (code/data) between the object
modules by assigning all the user subroutine and library subroutine
addresses. This activity is called linking.
3) There are some address dependent locations in the program, such
address constants must be adjusted according to allocated space, such
activity done by loader is called relocation.
Functions of Loader
4) Finally it places all the machine instructions and data of corresponding programs and
subroutines into the memory. Thus program now becomes ready for execution, this
activity is called loading.
 Steps:
1. Read executable file’s header to determine the size of text and data segments.
2. Create a new address space for the program. Copies instructions and data into
address space. Copies arguments passed to the program on the stack. Initializes
the machine registers including the stack pointer.
3. Jumps to a startup routine that copies the program’s arguments from the stack to
registers and calls the program’s main routine.
Types of Loaders
 Compile/Assemble and Go loader: In compile and go loader is a link
editor/program loader in which the assembler itself places the assembled
instruction directly into the designated memory locations for execution.
 General Scheme Loader: In this loader scheme, the source program is
converted to object program by some translator (assembler). The loader
accepts these object modules and puts machine instruction and data in
an executable form at their assigned memory. The loader occupies some
portion of main memory.
Types of Loaders
 Absolute Loader: An absolute loader is simple loader which performs loading process
and need not to perform linking and program relocation processes.
 Relocating Loader : When a single subroutine is changed then all the subroutines
need to be reassembled. The task of allocation and linking must be carried out once again.
To avoid this rework a new class of loaders is introduced which is called relocating loader.
 Direct Linking Loader: A Direct linking loader is a general relocating loader and
is the most popular loading scheme presently used. This scheme has an
advantage that it allows the programmer to use multiple procedure and multiple
data segments.

More Related Content

PPTX
Fundamentals of Language Processing
PPT
File handling in c
PPTX
Linkers
PPTX
Preprocessor directives in c language
PDF
Linker and Loader Explained
PPT
Assembler
PPT
Fundamentals of Language Processing
File handling in c
Linkers
Preprocessor directives in c language
Linker and Loader Explained
Assembler

What's hot (20)

PDF
loaders and linkers
PPTX
Introduction to loaders
PPTX
Single pass assembler
PDF
File organization
PPTX
Ch 4 linker loader
PPT
Analysis of the source program
PDF
Macro-processor
PPTX
System software - macro expansion,nested macro calls
PPTX
File Organization
PPTX
Direct linking loaders
PPTX
1.8. equivalence of finite automaton and regular expressions
PPTX
Linker and Loader
PPT
Basics of C programming
PPTX
Loader and Its types
PDF
10.Design Of Two Pass Assembler in system software.pdf
PPTX
Computer architecture virtual memory
PPT
Introduction To Database.ppt
PPTX
Introduction to c programming
PPT
Data independence
PDF
Database backup and recovery
loaders and linkers
Introduction to loaders
Single pass assembler
File organization
Ch 4 linker loader
Analysis of the source program
Macro-processor
System software - macro expansion,nested macro calls
File Organization
Direct linking loaders
1.8. equivalence of finite automaton and regular expressions
Linker and Loader
Basics of C programming
Loader and Its types
10.Design Of Two Pass Assembler in system software.pdf
Computer architecture virtual memory
Introduction To Database.ppt
Introduction to c programming
Data independence
Database backup and recovery
Ad

Similar to Loaders and Linkers (20)

PDF
Hm system programming class 1
PPTX
Linking in MS-Dos System
PPTX
linkerloader ss-2.pptx
PPTX
Linkers in compiler
PDF
Unit 3
PPTX
Loaders ( system programming )
PPTX
Lec 2 Compiler, Interpreter, linker, loader.pptx
PDF
Embedded systems designUNIT 4 PART 2.pdf
PPTX
linker & loader presentation in Compiler Design
PPTX
Assembly-and-Linking-From-Instructions-to-Execution.pptx
PDF
CS8251_QB_answers.pdf
PDF
Introduction To C++ programming and its basic concepts
PDF
Module-4 Program Design and Anyalysis.pdf
PPTX
System software module 3 presentation file
PPTX
System software module 3 presentation file
PPT
Loaders complete
PPTX
Linkers
PPTX
Vdsssssssssssssssssssssssssssssssssssssssss.pptx
PPTX
Build process ppt.pptx
PPT
System software-loaders
Hm system programming class 1
Linking in MS-Dos System
linkerloader ss-2.pptx
Linkers in compiler
Unit 3
Loaders ( system programming )
Lec 2 Compiler, Interpreter, linker, loader.pptx
Embedded systems designUNIT 4 PART 2.pdf
linker & loader presentation in Compiler Design
Assembly-and-Linking-From-Instructions-to-Execution.pptx
CS8251_QB_answers.pdf
Introduction To C++ programming and its basic concepts
Module-4 Program Design and Anyalysis.pdf
System software module 3 presentation file
System software module 3 presentation file
Loaders complete
Linkers
Vdsssssssssssssssssssssssssssssssssssssssss.pptx
Build process ppt.pptx
System software-loaders
Ad

More from kunj desai (10)

PPTX
OLAP operations
PPT
Bottom - Up Parsing
PPT
Binary Search
PPTX
Introduction to 8085 microprocessor
PPT
Custom Controls in ASP.net
PPT
JDBC Connectivity Model
PPT
Requirement specification (SRS)
PPT
Minimization of DFA
PPT
php databse handling
PPTX
Concept of constructors
OLAP operations
Bottom - Up Parsing
Binary Search
Introduction to 8085 microprocessor
Custom Controls in ASP.net
JDBC Connectivity Model
Requirement specification (SRS)
Minimization of DFA
php databse handling
Concept of constructors

Recently uploaded (20)

PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PDF
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
PPT
Total quality management ppt for engineering students
PPTX
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
PPTX
Fundamentals of Mechanical Engineering.pptx
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PDF
Abrasive, erosive and cavitation wear.pdf
PDF
Improvement effect of pyrolyzed agro-food biochar on the properties of.pdf
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PDF
distributed database system" (DDBS) is often used to refer to both the distri...
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PPTX
"Array and Linked List in Data Structures with Types, Operations, Implementat...
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPTX
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
PPTX
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
PDF
August -2025_Top10 Read_Articles_ijait.pdf
PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PPTX
Information Storage and Retrieval Techniques Unit III
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
Total quality management ppt for engineering students
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
Fundamentals of Mechanical Engineering.pptx
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
Abrasive, erosive and cavitation wear.pdf
Improvement effect of pyrolyzed agro-food biochar on the properties of.pdf
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
distributed database system" (DDBS) is often used to refer to both the distri...
III.4.1.2_The_Space_Environment.p pdffdf
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
"Array and Linked List in Data Structures with Types, Operations, Implementat...
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
August -2025_Top10 Read_Articles_ijait.pdf
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
Information Storage and Retrieval Techniques Unit III

Loaders and Linkers

  • 1. Loaders and Linkers  Name: Kunj Desai  Branch: CSE A  Semester: 5th  Year: 2016
  • 2. Translation Hierarchy  Compiler : Translates high-level language program into assembly language.  Assembler: Converts assembly language programs into object files.  Object files contain a combination of machine instructions, data, and information needed to place instructions properly in memory.
  • 3. Flow of the Hierarchy
  • 5. Process for producing an executable file
  • 6. Explanation to Linker  Definition: Tool that merges the object files produced by separate compilation or assembly and creates an executable file.  Three tasks done by LINKER:  Searches the program to find library routines used by program, e.g. printf(),sqrt(),strcat() and various other.  Determines the memory locations that code from each module will occupy and relocates its instructions by adjusting absolute references.
  • 7. Explanation to Linker  Relocation, which modifies the object program so that it can be loaded at an address different from the location originally specified. It combines two or more separate object programs and supplies the information needed to allow references between them .
  • 8. Linking Concepts  Computer programs typically comprise several parts or modules; all these parts/modules need not be contained within a single object file, and in such case refer to each other by means of symbols. Typically, an object file can contain three kinds of symbols:  Publicly defined symbols, which allow it to be called by other modules , also called as public definition .  Externally defined symbols(undefined symbols), which calls the other modules where these symbols are defined, also called as external reference.  Local symbols, used internally within the object file to facilitate relocation.
  • 9. Static Linking  Static linking occurs when a calling program is linked to a called program in a single executable module. When the program is loaded, the operating system places into memory a single file that contains the executable code and data.  The result of statically linking programs is an .EXE file or dynamic link library (DLL) subprogram that contains the executable code for multiple programs. This file includes both the calling program and the called program.
  • 10. Advantages and Disadvantages  Advantages  The advantage of static linking is that you can create self- contained, independent programs. In other words, the executable program consists of one part (the .EXE file) that you need to keep track of.  Disadvantages:  You cannot change the behavior of executable files without re-linking them.  External called programs cannot be shared, requiring that duplicate copies of programs be loaded in memory if more than one calling program needs to access them.
  • 11. Dynamic linking  Many operating system environments allow dynamic linking, that is the postponing of the resolving of some undefined symbols until a program is run.  That means that the executable code still contains undefined symbols, plus a list of objects or libraries that will provide definitions for these. Loading the program will load these objects/libraries as well, and perform a final linking.
  • 12. Advantages  Advantages :  Often-used libraries (for example the standard system libraries) need to be stored in only one location, not duplicated in every single binary.  If an error in a library function is corrected by replacing the library, all programs using it dynamically will benefit from the correction after restarting them. Programs that included this function by static linking would have to be re-linked first.
  • 13. Disadvantages  Disadvantages:  Known on the Windows platform as "DLL Hell", an incompatible updated DLL will break executables that depended on the behavior of the previous DLL.  A program, together with the libraries it uses, might be certified (e.g. as to correctness, documentation requirements, or performance) as a package, but not if components can be replaced.
  • 14. Definition of Loader  Loader is utility program which takes object code as input prepares it for execution and loads the executable code into the memory. Thus loader is actually responsible for initiating the execution process.  It is a SYSTEM PROGRAM that brings an executable file residing on disk into memory and starts it running.
  • 15. Functions of Loader  The loader is responsible for the activities such as allocation, linking , relocation and loading: 1) It allocates the space for program in the memory, by calculating the size of the program. This activity is called allocation. 2) It resolves the symbolic references (code/data) between the object modules by assigning all the user subroutine and library subroutine addresses. This activity is called linking. 3) There are some address dependent locations in the program, such address constants must be adjusted according to allocated space, such activity done by loader is called relocation.
  • 16. Functions of Loader 4) Finally it places all the machine instructions and data of corresponding programs and subroutines into the memory. Thus program now becomes ready for execution, this activity is called loading.  Steps: 1. Read executable file’s header to determine the size of text and data segments. 2. Create a new address space for the program. Copies instructions and data into address space. Copies arguments passed to the program on the stack. Initializes the machine registers including the stack pointer. 3. Jumps to a startup routine that copies the program’s arguments from the stack to registers and calls the program’s main routine.
  • 17. Types of Loaders  Compile/Assemble and Go loader: In compile and go loader is a link editor/program loader in which the assembler itself places the assembled instruction directly into the designated memory locations for execution.  General Scheme Loader: In this loader scheme, the source program is converted to object program by some translator (assembler). The loader accepts these object modules and puts machine instruction and data in an executable form at their assigned memory. The loader occupies some portion of main memory.
  • 18. Types of Loaders  Absolute Loader: An absolute loader is simple loader which performs loading process and need not to perform linking and program relocation processes.  Relocating Loader : When a single subroutine is changed then all the subroutines need to be reassembled. The task of allocation and linking must be carried out once again. To avoid this rework a new class of loaders is introduced which is called relocating loader.  Direct Linking Loader: A Direct linking loader is a general relocating loader and is the most popular loading scheme presently used. This scheme has an advantage that it allows the programmer to use multiple procedure and multiple data segments.

Editor's Notes

  • #17: <number>