16
Section 1: General Information
TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution
Beta Version February 2, 2001
The linker, which knows the addresses of all symbols, adds the address of the
symbol referenced by the r_sym_index field to the contents of the hole. In
addition, if the reference is PC-relative and the hole is in a relocatable section,
the base address of this section is subtracted from the contents of the hole.
In the case of byte or word references (1-byte or 2-byte holes, respectively), it is
possible that the final value determined by the linker will fit in the hole but the
intermediate value to be filled in by the assembler will not fit. Sierra Systems has
added an extension to the COFF standard to remove this deficiency. In the
relocation entry, the higher order byte of the r_type_info field and the highest
order byte of the r_sym_index field (assuming fewer than 16 million symbols)
are unused. In the case of a 1-byte or 2-byte hole, the overflow first goes into the
unused byte in r_sym_index and then into the unused byte in r_type_info
effectively providing the assembler with a 24-bit or 32-bit hole, respectively.
1.4.5.2. Complex
Relocation
A complex relocatable expression is an expression that cannot be reduced at
assembly time to either an absolute value or a section-relative reference. For
example, an expression that references multiple external symbols and/or
symbols from different relocatable sections would be classified complex
relocatable.
A complex relocatable expression is saved in a sequence of auxiliary relocation
entries that follow the primary entry for the relocation hole. A separate entry is
used for each operand and each operator in the expression. Table 1.10
describes the different types of complex relocation entries. The complex
expression contained in the auxiliary relocation entries is subsequently evaluated
by the linker, and the result is placed in the hole referenced by the primary entry.
COFF Relocation Entry
r_virt_addr r_sym_index r_type_info
Primary Entry hole address entry count type and size
Operator operator code – RL_CMPLX_OP
Absolute Operand value – RL_CMPLX_ABS
Reloc Operand section offset section index RL_CMPLX_REL
External Operand – symbol index RL_CMPLX_EXT
Table 1.10: Complex Relocation Entries
Note that the field r_type_info for the primary entry has the RL_CMPLX_OP bit
set to designate the start of a complex relocatable expression.