[PATCH] D15760: [ELF][MIPS] Implement R_MIPS_GPREL16/R_MIPS_GPREL32 relocation
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 23 16:25:54 PST 2015
ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.
LGTM with a few nits.
================
Comment at: ELF/InputFiles.h:126
@@ +125,3 @@
+ // This value represents the gp value used to create the relocatable object.
+ uint32_t getMipsGp0() const;
+
----------------
It is even better if you mention that the function is needed to support R_MIPS_GPREL16 / R_MIPS_GPREL32 relocations.
================
Comment at: ELF/InputSection.cpp:190
@@ -189,1 +189,3 @@
uintX_t SymVA = getLocalRelTarget(*File, RI, A);
+ if (Config->EMachine == EM_MIPS &&
+ (Type == R_MIPS_GPREL16 || Type == R_MIPS_GPREL32))
----------------
Please add a comment here why we need this.
================
Comment at: ELF/Target.cpp:1392-1396
@@ -1385,1 +1391,7 @@
+ }
+ case R_MIPS_GPREL32: {
+ int64_t V = SA + int32_t(read32<E>(Loc)) - getMipsGpAddr<ELFT>();
+ write32<E>(Loc, V);
+ break;
+ }
case R_MIPS_HI16: {
----------------
case R_MIPS_GPREL32:
write32<E>(Loc, SA + int32_t(read32<E>(Loc)) - getMipsGpAddr<ELFT>());
break;
Repository:
rL LLVM
http://reviews.llvm.org/D15760
More information about the llvm-commits
mailing list