[PATCH] D71683: [ORC][EH] Deregister EH frames in MemoryManager dtor

Min-Yih Hsu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 18 17:59:36 PST 2019


myhsu created this revision.
myhsu added a reviewer: lhames.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
myhsu edited the summary of this revision.

Try to fix Bug 23991 <https://bugs.llvm.org/show_bug.cgi?id=23991>

Note that we can not deregister in ~MemoryManager since some compiler runtime implementations (e.g. libgcc) would access memory content during deregisteration, but some of the MemoryManager implementations (e.g. SectionMemoryManager) would unmap all the memory sections in dtor.

This bug was also found when Pony programming language try to upgrade to LLVM 9.x <https://github.com/ponylang/ponyc/pull/3320#issuecomment-547474338>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71683

Files:
  llvm/lib/ExecutionEngine/SectionMemoryManager.cpp


Index: llvm/lib/ExecutionEngine/SectionMemoryManager.cpp
===================================================================
--- llvm/lib/ExecutionEngine/SectionMemoryManager.cpp
+++ llvm/lib/ExecutionEngine/SectionMemoryManager.cpp
@@ -226,6 +226,7 @@
 }
 
 SectionMemoryManager::~SectionMemoryManager() {
+  deregisterEHFrames();
   for (MemoryGroup *Group : {&CodeMem, &RWDataMem, &RODataMem}) {
     for (sys::MemoryBlock &Block : Group->AllocatedMem)
       MMapper.releaseMappedMemory(Block);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71683.234645.patch
Type: text/x-patch
Size: 499 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191219/0ab7660e/attachment.bin>


More information about the llvm-commits mailing list