[PATCH] D146938: RuntimeDyldELF: Clear GOTOffsetMap when resetting GOT section

Graham Markall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 27 02:14:57 PDT 2023


gmarkall created this revision.
gmarkall added a reviewer: lhames.
Herald added a subscriber: hiraditya.
Herald added a project: All.
gmarkall requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146938

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
@@ -2406,6 +2406,7 @@
     }
   }
 
+  GOTOffsetMap.clear();
   GOTSectionID = 0;
   CurrentGOTIndex = 0;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146938.508540.patch
Type: text/x-patch
Size: 359 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230327/2eaf776e/attachment.bin>


More information about the llvm-commits mailing list