[RuntimeDyld] RuntimeDyldELF: Clear GOTOffsetMap when resetting GOT section.
authorGraham Markall <gmarkall@nvidia.com>
Mon, 3 Apr 2023 18:15:36 +0000 (11:15 -0700)
committerLang Hames <lhames@gmail.com>
Mon, 3 Apr 2023 18:37:07 +0000 (11:37 -0700)
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

llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp

index 3c7f4ec..282c357 100644 (file)
@@ -2406,6 +2406,7 @@ Error RuntimeDyldELF::finalizeLoad(const ObjectFile &Obj,
     }
   }
 
+  GOTOffsetMap.clear();
   GOTSectionID = 0;
   CurrentGOTIndex = 0;