<div dir="ltr">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.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 3, 2016 at 7:55 AM, Simon Atanasyan <span dir="ltr"><<a href="mailto:simon@atanasyan.com" target="_blank">simon@atanasyan.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">atanasyan added a comment.<br>
<span class=""><br>
In <a href="http://reviews.llvm.org/D16817#342067" rel="noreferrer" target="_blank">http://reviews.llvm.org/D16817#342067</a>, @ruiu wrote:<br>
<br>
> If MIPS is so different than the other archs, how about creating relocateOneMips? Do you think that will simplify the code?<br>
<br>
<br>
</span>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.<br>
<br>
  if (Config->EMachine == EM_MIPS)<br>
    Target->relocateOneMips(File, Body, BufLoc, BufEnd, Type, AddrLoc, SymVA + A, Size + A,<br>
                            findMipsPairedReloc(Buf, SymIndex, Type, NextRelocs));<br>
  else<br>
    Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA + A, Size + A,<br>
                        findMipsPairedReloc(Buf, SymIndex, Type, NextRelocs));<br>
<br>
Not sure that this will look better.<br>
<br>
>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()`.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D16817" rel="noreferrer" target="_blank">http://reviews.llvm.org/D16817</a><br>
<br>
<br>
<br>
</div></div></blockquote></div><br></div>