[PATCH] D16817: [ELF][MIPS] Pass InputFile and SymbolBody to the Target::relocateOne method

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 3 07:55:57 PST 2016


atanasyan added a comment.

In http://reviews.llvm.org/D16817#342067, @ruiu wrote:

> If MIPS is so different than the other archs, how about creating relocateOneMips? Do you think that will simplify the code?


Now we call the `relocateOne` in four places in the `InputSectionBase::relocate()` code. If we introduce `relocateOneMips` we have to add `if (EMachine == EM_MIPS)` statement to all these places.

  if (Config->EMachine == EM_MIPS)
    Target->relocateOneMips(File, Body, BufLoc, BufEnd, Type, AddrLoc, SymVA + A, Size + A,
                            findMipsPairedReloc(Buf, SymIndex, Type, NextRelocs));
  else
    Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA + A, Size + A,
                        findMipsPairedReloc(Buf, SymIndex, Type, NextRelocs));

Not sure that this will look better.

>From the other side, the R_MIPS_26 relocation uses different formulas to calculate result for local / global symbols. To implement that I will need to know the type of symbols in the `relocateOne` or will have to add more MIPS specific code to the `InputSectionBase::relocate()`.


Repository:
  rL LLVM

http://reviews.llvm.org/D16817





More information about the llvm-commits mailing list