12.8 Linker Operation under DOS

LINK performs the following steps to produce a DOS executable file:

1.Reads the object modules submitted

2.Searches the given libraries, if necessary, to resolve external references

3.Assigns addresses to segments

4.Assigns addresses to public symbols

5.Reads code and data in the segments

6.Reads all relocation references in object modules

7.Performs fixups

8.Outputs an executable file (executable image and relocation information)

Steps 5, 6, and 7 are performed iteratively—that is, LINK repeats these steps as many times as required before it progresses to step 8.

The “executable image” contains the code and data that constitute the executable file. The “relocation information” is a list of references relative to the start of the program, each of which changes when the executable image is loaded into memory and an actual address for the entry point is assigned.

The following sections explain the process LINK uses to concatenate segments and resolve references to items in memory.