FOR
TERM PAPER
ON
LINKERS AND LOADERS
Submitted to: Submitted by:
Asst.Lect. Darvinder Kaur Pratik Raj
Sec:K1R13
Roll no.:A10
Introduction
Linker
In computer science, a linker or link editor is a program that takes one or more objects generated by a compiler and combines them into a single executable program.
[pic]
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:
• defined symbols, which allow it to be called by other modules,
• undefined symbols, which call the other modules where these symbols are defined, and
• local symbols, used internally within the object file to facilitate relocation.
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 are 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 re-targeting of absolute jumps, loads and stores.
The executable output by
References: • David William Barron, Assemblers and Loaders. 1972, Elsevier. • C. W. Fraser and D. R. Hanson, A Machine Independent Linker. Software-Practice and Experience 12, 4 (April 1982). • The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition. The Open Group. Retrieved 2008-06-23. • John R. Levine: Linkers and Loaders, Morgan-Kauffman