[llvm-dev] [lld] Special R_MIPS_HI16 / R_MIPS_LO16 calculation for _gp_disp symbol

Rui Ueyama via llvm-dev llvm-dev at lists.llvm.org
Sun Nov 22 19:31:06 PST 2015


On Sun, Nov 22, 2015 at 6:57 AM, Simon Atanasyan <simon at atanasyan.com>
wrote:

> Separated from the "[lld] R_MIPS_HI16 / R_MIPS_LO16 calculation" thread.
>
> On Sat, Nov 21, 2015 at 9:28 AM, Rui Ueyama <ruiu at google.com> wrote:
> > On Fri, Nov 20, 2015 at 10:13 PM, Simon Atanasyan <simon at atanasyan.com>
> > wrote:
> >> R_MIPS_HI16 and R_MIPS_LO16 relocations perform a special calculation
> >> if a target symbol's name is `_gp_disp` [2]. AFAIK now in the target
> >> `relocateOne` method there is no chance to get the traget symbol name.
> >> Is it okay to pass the target symbol index and provide
> >> `MipsTargetInfo` access to the symbol table of the processing input
> >> file?
> >
> >
> > One way is to add a SymbolBody* field to Out<ELFT> struct, and let it
> have a
> > pointer to _gp_disp symbol. And do pointer comparison to check if a
> > relocation target is _gp_disp or not.
>
> Do you suggest to pass a pointer to SymbolBody to the `relocateOne`
> method and compare this pointer with something like
> `Out<ELFT>::MipsGpDispSym`?
>

Ah, I didn't realize that relocateOne doesn't take a symbol.

I'm not sure what's the simplest way, but you might want to add a new
parameter to relocateOne.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151122/ace39ab0/attachment.html>


More information about the llvm-dev mailing list