Contents    Page-10    Prev    Next    Page+10    Index   

Form of Relocatable Code

Program code consists of instructions; each instruction may have an address field that contains the offset of a variable or label from its data area. In addition, the instruction will have a relocation bit or field that indicates whether the address should be relocated. If the relocation bit is set, the corresponding location counter is added to the address.

R is a relocation code; it could be:

  1. Do not modify the word.

  2. Relocate the address field by adding the value of location counter LC to it.

  3. Replace the address field by the address of the external symbol whose number is given in the address field.

Relocatable code may contain other kinds of code items, e.g., BSS codes to specify blocks to be filled with a specified value such as 0.