[llvm] 2e1b838 - [RuntimeDyld] RuntimeDyldELF: Clear GOTOffsetMap when resetting GOT section.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 3 11:37:22 PDT 2023


Author: Graham Markall
Date: 2023-04-03T11:37:07-07:00
New Revision: 2e1b838a889f9793d4bcd5dbfe10db9796b77143

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

LOG: [RuntimeDyld] RuntimeDyldELF: Clear GOTOffsetMap when resetting GOT section.

When the GOT section ID is reset, the GOTOffsetMap must also be cleared,
otherwise spurious matches can be located when handling GOT relocations
in subsequently-linked objects.

Fixes Issue #61402 - see https://github.com/llvm/llvm-project/issues/61402.

Reviewed By: lhames

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

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 3c7f4ec47eb84..282c357f2de2c 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -2406,6 +2406,7 @@ Error RuntimeDyldELF::finalizeLoad(const ObjectFile &Obj,
     }
   }
 
+  GOTOffsetMap.clear();
   GOTSectionID = 0;
   CurrentGOTIndex = 0;
 


        


More information about the llvm-commits mailing list