[PATCH] [RuntimeDyldELF] Improve GOT support

Lang Hames lhames at gmail.com
Mon Apr 6 12:41:11 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);
----------------
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?

================
Comment at: lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:270-273
@@ -279,4 +269,6 @@
     uint64_t FinalAddress = Section.LoadAddress + Offset;
-    support::ulittle64_t::ref(Section.Address + Offset) =
-        Placeholder + Value + Addend - FinalAddress;
+    int64_t RealOffset = Value + Addend - FinalAddress;
+    if (Offset < Section.Size)
+      RealOffset += Placeholder;
+    support::ulittle64_t::ref(Section.Address + Offset) = RealOffset;
     break;
----------------
Ditto here.

http://reviews.llvm.org/D8813

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






More information about the llvm-commits mailing list