[PATCH] D107087: Fix SectionMemoryManager deconstruction error with MSVC

Justice Adams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 17 10:20:32 PDT 2021


justice_adams added a comment.

@lhames Sorry for the broken build, I didn't realize clang tests would be affected here.

I'm happy to continue working towards the correct approach here. Also thanks for the help so far!

> A better solution to this problem might be to document that global `SectionMemoryManager`s are not allowed, then update the tutorial to avoid using them

Is the problem with `SectionMemoryManager` being global, or is it with the fact that the class internally relies on a variable of static storage duration (`DefaultMMapperInstance`) which may be wiped out before the `SectionMemoryManager`s own deconstruction?

If the solution is to enforce that no `SectionMemoryManager` are global, how would we enforce that programmatically?

In the tutorial case, the `RTDyldObjectLinkingLayer` holds onto the `SectionMemoryManager` instance, so it's not necessarily globally defined
https://reviews.llvm.org/source/llvm-github/browse/main/llvm/examples/Kaleidoscope/include/KaleidoscopeJIT.h$49
But the object it's contained in (The KaleidascopeJIT) is of static storage duration which causes the original error.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107087/new/

https://reviews.llvm.org/D107087



More information about the llvm-commits mailing list