Once the starting address of each segment in a program is known and all segment combinations and groups have been established, LINK can “fix up” any unresolved references to labels and variables. To fix up unresolved references, LINK computes an appropriate offset and segment address and replaces the temporary values generated by the assembler with the new values.
LINK carries out fixups for the types of references shown in Table 12.1.
The size of the value to be computed depends on the type of reference. If LINK discovers an error in the anticipated size of a reference, it displays a fixup-overflow message. This can happen, for example, if a program attempts to use a 16-bit offset to reach an instruction which is more than 64K away. It can also occur if all segments in a group do not fit within a single 64K block of memory.
Table 12.1 LINK Fixups
Type | Location of Reference | LINK Action |
Short | In JMP instructions that attempt to pass control to labeled instructions in the same segment or group. The target instruction must be no more than 128 bytes from the point of reference. | Computes a signed, eight-bit number for the reference and displays an error message if the target instruction belongs to a different segment or group (has a different frame address), or if the target is more than 128 bytes away in either direction. |
Near self-relative | In instructions that access data relative to the same segment or group. | Computes a 16-bit offset for the reference and displays an error if the data are not in the same segment or group. |
Near segment-relative | In instructions that attempt to access data in a specified segment or group, or relative to a specified segment register. | Computes a 16-bit offset for the reference and displays an error message if the offset of the target within the specified frame is greater than 64K or less than 0, or if the beginning of the canonical frame of the target is not addressable. |
Long | In CALL instructions that attempt to access an instruction in another segment or group. | Computes a 16-bit frame address and 16-bit offset for this reference, and displays an error message if the computed offset is greater than 64K or less than 0, or if the beginning of the canonical frame of the target is not addressable. |