This is an archive of the discontinued LLVM Phabricator instance.

[Mips] Support MIPS N64 relocation record format
ClosedPublic

Authored by atanasyan on Mar 22 2015, 1:42 PM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

atanasyan updated this revision to Diff 22439.Mar 22 2015, 1:42 PM
atanasyan retitled this revision from to [Mips] Support MIPS N64 relocation record format.
atanasyan updated this object.
atanasyan edited the test plan for this revision. (Show Details)
atanasyan added reviewers: shankarke, ruiu, Bigcheese.
atanasyan set the repository for this revision to rL LLVM.
atanasyan added a project: lld.
atanasyan added a subscriber: Unknown Object (MLST).

Can you make changes to native reader and writer too?

This revision is now accepted and ready to land.Mar 22 2015, 6:00 PM
atanasyan updated this revision to Diff 22455.Mar 23 2015, 4:08 AM
atanasyan edited edge metadata.

Add support of the Reference::tag() to native reader and writer.

ruiu accepted this revision.Mar 23 2015, 4:20 PM
ruiu edited edge metadata.

LGTM

atanasyan closed this revision.Mar 24 2015, 3:04 AM

Thanks for review.

Closed by commit rL233057.