This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Regroup code creates ELF relocations references ELFReference into a couple of new virtual functions
ClosedPublic

Authored by atanasyan on Apr 11 2014, 12:55 AM.

Details

Summary

Follow-up to the rL203408. Two virtual functions createRelocationReference() responsible for creation of ELFReference have been replaced by a couple of new virtual functions createRelocationReferences() (plural). Each former function creates a single ELFReference for a specified Elf_Rela or Elf_Rel relocation records. The new functions responsible for creation of all relocation references for provided symbol.

For all targets except MIPS there are no functional changes.

MIPS ABI has a notion of paired relocations. An effective addend of such relocations are calculated using addends of both pair's members. Each R_MIPS_HI16 and R_MIPS_GOT16 (for local symbols) relocations must have an associated R_MIPS_LO16 entry immediately following it in the list of relocations. Immediately does not mean "next record" in relocations section but "next record referenced the same symbol". Moreover a single R_MIPS_LO16 relocation can be paired with multiple preceding R_MIPS_HI16/R_MIPS_GOT16 relocations.

The paired relocation can have offsets belong to the different symbols. That is why we need to have access to list of all relocations during construction of ELFReference for MIPS target.

Diff Detail

Event Timeline

Thanks for review.

Closed by commit rL206102 (authored by @atanasyan)

atanasyan closed this revision.Apr 11 2014, 9:08 PM