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

Simon Atanasyan via llvm-dev llvm-dev at lists.llvm.org
Sun Nov 22 06:57:42 PST 2015


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`?

-- 
Simon Atanasyan


More information about the llvm-dev mailing list