[PATCH] D15480: [ELF][MIPS] Handle R_MIPS_HI16/LO16 relocations against _gp_disp symbol
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 14 13:02:23 PST 2015
ruiu added inline comments.
================
Comment at: ELF/InputSection.cpp:209-212
@@ -208,1 +208,6 @@
+ } else if (Config->EMachine == EM_MIPS) {
+ if (Type == R_MIPS_HI16 && Body.getName() == "_gp_disp")
+ SymVA = getMipsGpAddr<ELFT>() - AddrLoc;
+ else if (Type == R_MIPS_LO16 && Body.getName() == "_gp_disp")
+ SymVA = getMipsGpAddr<ELFT>() - AddrLoc + 4;
}
----------------
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.
Repository:
rL LLVM
http://reviews.llvm.org/D15480
More information about the llvm-commits
mailing list