Thursday, 31 May 2012

Linking requirement

In c program files are translated separately. Thus only function calls that cross files boundaries and references to global data require linking.
A reference to an external symbol can be resolved only if symbol is declared as a public definition in some object module. This observation forms the basis of program linking.
The linker process all object modules being linked and builds a table of all public definitions and their load time addresses.
Linking for symbol is simply a matter of searching for that symbol in this table and copying its linked address into the word containing the external reference.
A name table (NTAB) is defined for use in program linking. Each entry of the table contains 2 fields.
1.Symbol : symbolic name of public definition or an object module.
2.Linked address : for a public definition, this field contains linked address of the symbol. For an object module, it contains the linked origin of the object module.
Most information in NTAB is derived from LINKTAB entries with type = public definition.

No comments:

Post a Comment