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

Simon Atanasyan simon at atanasyan.com
Fri Apr 11 00:55:01 PDT 2014


Hi Bigcheese, shankarke,

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.

http://reviews.llvm.org/D3350

Files:
  lib/ReaderWriter/ELF/ELFFile.h
  lib/ReaderWriter/ELF/Mips/MipsELFFile.h
  lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
  test/elf/Mips/hilo16-4.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3350.1.patch
Type: text/x-patch
Size: 17062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140411/639c7b39/attachment.bin>


More information about the llvm-commits mailing list