Thursday 31 May 2012

Linker


A Linker is a program that is used to properly combine all the object program files of the s/w and to convert them into the final executable, which is called load module.
It means that a linker takes object program files and fits them together to assemble them into the program final executable form.
A module approach is used to develop reasonable sized software. In this approach the s/w is divided into a no. of smaller program and module.
It is easier to develop, test and debug smaller program.
Steps involved in execution of a program 
1.Translation of the program.
2.Linking of the program with other programs needed for its execution.
3.Relocation of the program to execute from the specific memory area allocated to it.
4.Loading of the program in the memory for the purpose of execution. 
 
Translated, linked and load time addresses
While compiling a program, a translator is given an origin specification for program. This is called the translated origin of program.
The program can specify the origin in a START or ORIGIN statement.
The translator uses the value of the translated origin to perform memory allocation for the variable declared in program.
The execution start address or simple the start address of a program is the address of the instruction from which its execution must begin.
The start address specified by the translator is the translated start address of the program.
The origin of a program may have to be changed by the linker or loader by one of two reasons.
1.The same set of translated address may have been used in different object modules constituting a program.
2.An operating system may require that a program should execute from a specific area of memory. This may require a change in its origin. The change of origin leads to changes in the execution start address and in the address assigned to symbols.
Following terminology is used to refer to the address of a program entity at different times :
1.Translation time address : address assigned by the translator.
2.Linked address : address assigned by the linker.
3.Load time or load address : address assigned by the loader.
The same prefixes translation time, linked and load time are used with the origin and execution start address of a program. Thus
1.Translated origin : address of the origin assumed by the translator.
2.Linked origin : address of the origin assigned by the linker while producing a binary program.
3.Load origin : address of the origin assigned by the loader while loading the program execution.
The linked and load origins may differ from the translated origin of a program.

1 comment: