0% found this document useful (0 votes)
29 views2 pages

POP Unit 3 Linker and Loader

Uploaded by

Sks Yt
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
0% found this document useful (0 votes)
29 views2 pages

POP Unit 3 Linker and Loader

Uploaded by

Sks Yt
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

A program that takes one or more object file and combine them
into a single executable file.
It performs the process of linking. Linkers are also known as
link editors.
It takes different object modules from compiler as input and
forms an executable file as output for the loader. Linking is
performed at the last step in combining a program.

What Linker does?


1. Combines Code Files: When you write a program, it might be
split into different files. The linker brings all these
pieces together.

2. Resolves References: Sometimes, a piece of code in one file


might need to use a function or a variable that's in
another file. The linker makes sure that everything is
connected properly so that the program runs correctly.

3. Creates the Final Executable: Once everything is linked,


the linker creates the final version of the program that
you can run on your computer.

Steps Involved in Linking:


1. Compiling: First, each part of the program is compiled into
an object file (.obj or .o). These files contain machine
code, but they aren’t ready to run yet.
2. Linking: The linker takes these object files and combines
them. Also resolves missing links between the files.
3. Output: The final result is an executable file (.exe on
Windows, or a binary on Linux/Mac).

Object file extension depends on operating system of computer.


for Windows  .obj
for UNIX  .o
Loader
A loader is a program that takes object code from the linker and
loads into the main memory.
So, the loader’s job is to find a ‘good’ place for object code
in RAM (Random Access Memory), where program can execute.

You might also like