100% found this document useful (1 vote)
188 views

Linker and Loader

Uploaded by

Ptavfbcvbn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
188 views

Linker and Loader

Uploaded by

Ptavfbcvbn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Linker and Loader

1. Linker: A linker is special program that combines the object files, generated by
compiler/assembler and other pieces of code to originate an executable file has .exe extension. In
the object file, linker searches and append all libraries needed for execution of file. It regulates the
memory space that will hold the code from each module. It also merges two or more separate object
programs and establishes link among them.
Generally, linkers are of two types :
1. Linkage Editor
2. Dynamic Linker

The linker performs several tasks, including:

•Symbol resolution: The linker resolves symbols in the program that are defined in one module and
referenced in another.
•Code optimization: The linker optimizes the code generated by the compiler to reduce code size
and improve program performance.
•Memory management: The linker assigns memory addresses to the code and data sections of the
program and resolves any conflicts that arise.
•Library management: The linker can link external libraries into the executable file to provide
additional functionality.

2. Loader: It is special program that takes input of executable files from linker, loads it to main
memory, and prepares this code for execution by computer. Loader allocates memory space to
program. Even it settles down symbolic reference between objects. It is in charge of loading
programs and libraries in operating system. The embedded computer systems don’t have loaders. In
them, code is executed through ROM. There are following various loading schemes:
1. Absolute Loaders
2. Relocating Loaders
3. Direct Linking Loaders
4. Bootstrap Loaders
The loader performs several tasks, including:
•Loading: The loader loads the executable file into memory and allocates memory for the program.
•Relocation: The loader adjusts the program’s memory addresses to reflect its location in memory.
•Symbol resolution: The loader resolves any unresolved external symbols that are required by the
program.
•Dynamic linking: The loader can dynamically link libraries into the program at runtime to provide
additional functionality.
Differences between Linker and Loader are as follows:

LINKER LOADER

The main function of Linker is to generate Whereas main objective of Loader is to load
executable files. executable files to main memory.

The linker takes input of object code generated And the loader takes input of executable
by compiler/assembler. files generated by linker.

Linking can be defined as process of combining Loading can be defined as process of


various pieces of codes and source code to loading executable codes to main memory
obtain executable code. for further execution.

Linkers are of 2 types: Linkage Editor and Loaders are of 4 types: Absolute,
Dynamic Linker. Relocating, Direct Linking, Bootstrap.

Another use of linker is to combine all object It helps in allocating the address to
modules. executable codes/files.

Loader is also responsible for adjusting


Linker is also responsible for arranging objects
references which are used within the
in program’s address space.
program.

Conclusion :
Linker and Loader are both important components in the software development process. The
Linker is used during the compilation process to link object files into a single executable file, while
the Loader is used at runtime to load the executable file into memory and prepare it for execution.
Understanding the differences between the two is important for efficient and effective software
development.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy