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.
How about creating a new field, MipsGpDisp of type SymbolBody*, to InputSection class as a public static member to avoid string comparison?
Or, you can modify SymbolTable::addIgnoredSym to return a symbol body which is just added, and assign it to Config or somewhere. And then compare that value's repl() with Body here.
I don't know which is better, or no strong preference.