Linker | Compiler Design - Computer Science Engineering (CSE) PDF Download

Introduction

Linker is a program in a system which helps to link object modules of a program into a single object file. It performs the process of linking. Linkers are also called as link editors. Linking is a process of collecting and maintaining piece of code and data into a single file. Linker also links a particular module into system library. It takes object modules from assembler as input and forms an executable file as output for the loader. Linking is performed at both compile time, when the source code is translated into machine code and load time, when the program is loaded into memory by the loader. Linking is performed at the last step in compiling a program.

Source code -> compiler -> Assembler -> Object code -> Linker -> Executable file -> Loader

Linking is of two types:

1. Static Linking: It is performed during the compilation of source program. Linking is performed before execution in static linking. It takes collection of relocatable object file and command-line arguments and generates a fully linked object file that can be loaded and run.
Static linker performs two major tasks:

  • Symbol resolution: It associates each symbol reference with exactly one symbol definition. Every symbol has a  predefined task.
  • Relocation: It relocates code and data section and modifies the symbol references to the relocated memory locations.

The linker copies all library routines used in the program into executable image. As a result, it requires more memory space. As it does not require the presence of library on the system when it is run, so it is faster and more portable. No failure chance and less error chance.

2. Dynamic linking: Dynamic linking is performed during the run time. This linking is accomplished by placing the name of a shareable library in the executable image. There are more chances of errors and failures. It require less memory space as multiple programs can share a single copy of the library. Here we can perform code sharing. It means if we are using the same object a number of times in the program, instead of linking the same object again and again into the library, each module shares information of the object with other modules having the same object. The shared library needed in the linking is stored in virtual memory to save RAM. In this linking we can also relocate the code for the smooth running of code but all the code is not relocatable. It fixes the address at run time.

The document Linker | Compiler Design - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Compiler Design.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
26 videos|66 docs|30 tests

Top Courses for Computer Science Engineering (CSE)

26 videos|66 docs|30 tests
Download as PDF
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Linker | Compiler Design - Computer Science Engineering (CSE)

,

Summary

,

Objective type Questions

,

Exam

,

Sample Paper

,

pdf

,

mock tests for examination

,

study material

,

Free

,

Linker | Compiler Design - Computer Science Engineering (CSE)

,

practice quizzes

,

Semester Notes

,

Previous Year Questions with Solutions

,

Important questions

,

ppt

,

MCQs

,

past year papers

,

Viva Questions

,

Linker | Compiler Design - Computer Science Engineering (CSE)

,

Extra Questions

,

shortcuts and tricks

,

video lectures

;