N64 ABI relocation record r_info field in fact consists of five subfields:
- r_sym - symbol index
- r_ssym - special symbol
- r_type3 - third relocation type
- r_type2 - second relocation type
- r_type - first relocation type
Up to three these relocations applied one by one. The first relocation uses an addendum from the relocation record. Each subsequent relocation takes as its addend the result of the previous operation. Only the final operation actually modifies the location relocated. The first relocation uses as a reference symbol specified by the r_sym field. The third relocation assumes NULL symbol.
The patch represents these data using LLD model and takes in account additional relocation types during a relocation calculation.
Additional relocations do not introduce any new relations between two atoms and just specify operations need to be done during a relocation calculation. The first relocation type (r_type) stored in the Reference::_kindValue. The rest of relocations and r_ssym value are stored in the new Reference::_tag field "as-is". I decided to do not "decode" these data on the core LLD level to prevent pollution of the core LLD model by very target specific data.
Also I have to override writing of relocation records in the RelocationTable class to convert MIPS N64 ABI relocation information from the Reference class back to the ELF relocation record.