Site Tools


ivss-relocation-entries

Table of Contents

Relocation entries (ivss)

A relocation entry describes a value that must be patched after resolving a symbol. In ivss, linking preserves these records and the emulator applies them while loading. Assembling .word target in my_data produces a zero placeholder and a record in .relamy_data:

Num  Offset      Type      Symbol  Addend
  0: 00000000    R_SS_32   3(target)    0

The offset identifies the first byte to patch within my_data. The relocation type requests a 32-bit value, the symbol index selects target, and the addend is zero.

The assembler fills the record as follows:

rela->r_offset = Elf_GetSectionSize(elf);
rela->r_info   = ELF_R_INFO(ELF_R_SYM(rela->r_info), type);
rela->r_addend = addend;

r_info combines the symbol index and relocation type. The current section size locates the pending emission, so the record and placeholder refer to the same position.

Other ivss types include relocations for expanded loads, where the address must be distributed through an instruction sequence rather than written as one contiguous data word. A relocation therefore specifies both which symbol matters and how its resolved value belongs in the emitted bytes.

Source: emulator.c, asembler.c, elf.c.

ivss-relocation-entries.md · Last modified: by 127.0.0.1