Describe the functions and features of Linker.

Linker:

There are certain programs which are large its size and cannot be executed at one go simultaneously. Such programs are divided into subprograms also known as modules. The linker is used to link such small programs to form one large program.

Function of Linker:

For most compilers, each object file is the result of compiling one input source code file. When a program comprises multiple object files, the linker combines these files into a unified  executable program, resolving the symbols as it goes along.

Linkers can take objects from a collection called a library:

Some linkers do not include the whole library in the output they only include its symbols that ale referenced from other object files or libraries. Libraries exist for diverse purposes, and one or more system libraries are usually linked in by default.

The linker also takes care of arranging the objects in a program’s address space. This may involve relocating code that assumes a specific base address to another base. Since a compiler seldom knows where an object will reside, it often assumes a fixed base location (for example, zero). Relocating machine code may involve targeting of absolute jumps, loads and stores.

Features of Linker

  • Often-used libraries (for example the standard system libraries) need to be stored in only one location, not duplicated in every single binary.
  • If a bug 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 linked first.

Tags: Bca

Owlgen
Logo
Compare items
  • Total (0)
Compare
0