Hardware Reference
In-Depth Information
1. It constructs a table of all the object modules and their lengths.
2. Based on this table, it assigns a base address to each object module.
3. It finds all the instructions that reference memory and adds to each a
relocation constant equal to the starting address of its module.
4. It finds all the instructions that reference other procedures and inserts
the address of these procedures in place.
The object module table constructed in step 1 is shown for the modules of
Fig. 7-14 below. It gives the name, length, and starting address of each module.
Module
Length
Starting address
A
400
100
B
600
500
C
500
1100
D
300
1600
Figure 7-14(b) shows how the address space of Fig. 7-14(a) looks after the linker
has performed these steps.
7.4.2 Structure of an Object Module
Object modules often contain six parts, as shown in Fig. 7-15. The first part
contains the name of the module, certain information needed by the linker, such as
the lengths of the various parts of the module, and sometimes the assembly date.
End of module
Relocation
dictionary
Machine instructions
and constants
External reference table
Entry point table
Identification
Figure 7-15. The internal structure of an object module produced by a translator.
The Identification field comes first.
The second part of the object module is a list of the symbols defined in the
module that other modules may reference, together with their values. For example,
if the module consists of a procedure named bigbug , the entry point table will
 
 
Search WWH ::




Custom Search