[llvm] f687378 - [RuntimeDyld] Implemented relocation for ELF::R_X86_64_GOTPC32

Moritz Sichert via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 6 01:31:28 PDT 2021


Author: Moritz Sichert
Date: 2021-09-06T10:26:37+02:00
New Revision: f6873786034ab752a50539badc0ce57ac11dda6c

URL: https://github.com/llvm/llvm-project/commit/f6873786034ab752a50539badc0ce57ac11dda6c
DIFF: https://github.com/llvm/llvm-project/commit/f6873786034ab752a50539badc0ce57ac11dda6c.diff

LOG: [RuntimeDyld] Implemented relocation for ELF::R_X86_64_GOTPC32

Differential Revision: https://reviews.llvm.org/D95512

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
index efe0b9cd61cd2..6e73c13694537 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -1813,10 +1813,13 @@ RuntimeDyldELF::processRelocationRef(
         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) {


        


More information about the llvm-commits mailing list