The _gp_disp is a magic symbol designates offset between start of function and gp pointer into GOT. Only R_MIPS_HI16 and R_MIPS_LO16 relocations are permitted with _gp_disp. The patch adds the _gp_disp as an ignored symbol and adjusts symbol value before call the relocateOne for R_MIPS_HI16/LO16 relocations.
I put code which adjust symbol value in case of R_MIPS_HI16/LO16 relocations into the InputSectionBase<ELFT>::relocate routine to escape passing SymboBody to each relocateOne methods while it is necessary for MIPS target only.
It is possible to optimize the current solution a bit. We can save a reference to the SymbolBody instance created by the addIgnoredSym call and replace "_gp_disp" string comparison by comparison of SymbolBody references. But I cannot find a good place to keep the reference to the "_gp_disp" SymbolBody.
I thinking about that place last time.
May be we should add A argument to Target->relocateOne() ?
That can help to move that calculation to mips target, since it looks like absence of A inside relocateOne() is the only stoppable for doing that.