[PATCH] D95512: [RuntimeDyld] Implemented relocation for ELF::R_X86_64_GOTPC32

Moritz Sichert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 6 00:40:35 PDT 2021


MoritzS updated this revision to Diff 356623.
MoritzS added a comment.

Rebased onto main


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95512/new/

https://reviews.llvm.org/D95512

Files:
  llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp


Index: llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
===================================================================
--- llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -1813,10 +1813,13 @@
         addRelocationForSymbol(RE, Value.SymbolName);
       else
         addRelocationForSection(RE, Value.SectionID);
-    } else if (RelType == ELF::R_X86_64_GOTPC64) {
+    } else if (RelType == ELF::R_X86_64_GOTPC32) {
       // Materialize the address of the base of the GOT relative to the PC.
       // This doesn't create a GOT entry, but it does mean we need a GOT
       // section.
+      (void)allocateGOTEntries(0);
+      resolveGOTOffsetRelocation(SectionID, Offset, Addend, ELF::R_X86_64_PC32);
+    } else if (RelType == ELF::R_X86_64_GOTPC64) {
       (void)allocateGOTEntries(0);
       resolveGOTOffsetRelocation(SectionID, Offset, Addend, ELF::R_X86_64_PC64);
     } else if (RelType == ELF::R_X86_64_GOTOFF64) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95512.356623.patch
Type: text/x-patch
Size: 1012 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210706/c8617494/attachment.bin>


More information about the llvm-commits mailing list