[PATCH] [RuntimeDyldELF] Improve GOT support

Keno Fischer kfischer at college.harvard.edu
Mon Apr 6 12:45:54 PDT 2015


REPOSITORY
  rL LLVM

================
Comment at: lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:255-258
@@ -267,3 +254,6 @@
     uint64_t FinalAddress = Section.LoadAddress + Offset;
-    int64_t RealOffset = Placeholder + Value + Addend - FinalAddress;
+    int64_t RealOffset = Value + Addend - FinalAddress;
+    // Don't add the placeholder if this is a stub
+    if (Offset < Section.Size)
+      RealOffset += Placeholder;
     assert(RealOffset <= INT32_MAX && RealOffset >= INT32_MIN);
----------------
lhames wrote:
> Would it be better to zero out the GOT entry when it's reserved so that you don't need to special-case the placeholder logic here?
No, that doesn't work because the placeholder pull values out of the original (unrelocated) object file, which does not have the stub. The better direction to go is to encode everything that's needed into the Addend, but that's a separate and more invasive change.

http://reviews.llvm.org/D8813

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list