Section 1: General Information
15
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual Not for Distribution
Beta Version February 2, 2001
Bytes Declaration Name Description
0-3 unsigned long r_virt_addr Virtual address of reference
4-7 unsigned long r_sym_index Symbol table index
8-9 unsigned short r_type_info Relocation type (see Table 1.9)
Table 1.8: Relocation Section Contents
The first field of the relocation entry is the virtual address of the text or data to
which the entry applies. The 1-, 2-, or 4-byte area referenced by this first field is
known as a hole since the assembler cannot resolve the reference. The address
or PC-relative offset is ultimately determined and written to the hole by the linker.
The second field is the index of the symbol table entry for the symbol that is
being referenced. The third field indicates the type of relocation that is to be
applied. Table 1.9 lists the relocation types supported by Sierra Systems.
Mnemonic Flag Meaning
RL_FIXED 0x00 Reference is absolute, no relocation is necessary, the entry
will be ignored
RL_DIR_BYTE 0x0F Direct 8-bit reference to symbol's virtual address
RL_DIR_WORD 0x10 Direct 16-bit reference to symbol's virtual address
RL_DIR_LONG 0x11 Direct 32-bit reference to symbol's virtual address
RL_PC_BYTE 0x12 A PC-relative 8-bit reference to symbol's virtual address
RL_PC_WORD 0x13 A PC-relative 16-bit reference to symbol's virtual address
RL_PC_LONG 0x14 A PC-relative 32-bit reference to symbol's virtual address
RL_CMPLX_OP 0x40 Operator in a complex relocatable expression
RL_CMPLX_ABS 0x50 Absolute operand in a complex relocatable expression
RL_CMPLX_REL 0x60 Relocatable operand in a complex relocatable expression
RL_CMPLX_EXT 0x70 External operand in a complex relocatable expression
Table 1.9: Relocation Types
1.4.5.1. Relocation
There are two types of relocation: absolute and PC-relative. The assembler
reduces an unresolved reference to an offset from a relocatable section or an
offset from an external symbol. The offset is saved in the hole and the index of
the symbol (external symbol or section name symbol) is saved in the relocation
entry. In addition, if the reference is PC-relative, the address or section-relative
offset of the hole is subtracted from the contents of the hole.