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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 3 16:36:41 PST 2016


I was experimenting a few ideas to apply relocations in different ways, but
didn't get a better way yet. It is possible that we will end up just having
to add two more parameters to the function, but I'd like to experiment a
little bit more. Please give me a few more days.

On Wed, Feb 3, 2016 at 7:55 AM, Simon Atanasyan <simon at atanasyan.com> wrote:

> 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
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160203/d8ff9271/attachment.html>


More information about the llvm-commits mailing list