External relocatable terms

A term is external relocatable (E_EXT) if it is an external symbol (a symbol not defined, but declared within the current file, or defined in the current file and global), a csect name, or a TOC entry name.

This term is relocatable because its value will change if it, or its containing control section, is relocated.

An external relocatable term or expression cannot be used as the operand of a .set pseudo-op.

An external relocatable term is one of the following items:

  • A symbol defined with the .comm pseudo-op
  • A symbol defined with the .lcomm pseudo-op
  • A csect name
  • A symbol declared with the .globl pseudo-op
  • A TOC entry name
  • An undefined symbol declared with the .extern pseudo-op

Except for the undefined symbol, if this term is not used as a displacement for a D-form instruction, its value is its relocatable address, which is the offset relative to the beginning of the first csect in the file. If it is used as a displacement for a D-form instruction, the assembler implicitly subtracts the containing csect address (except for a TOC entry name), usually producing a zero displacement because the csect address is subtracted from itself. If a TOC entry name is used as a displacement for a D-form instruction, the assembler implicitly subtracts the address of the TOC anchor, so the offset relative to the TOC anchor is the displacement.

An undefined symbol cannot be used as a displacement for a D-form instruction. In other cases, its value is zero.