The bug was reported here https://bugs.llvm.org/show_bug.cgi?id=52030
This patch follows the idea that @lhames commented in the above webpage.
Paths
| Differential D110990
[Orc] Fix global variable destructor function support when --jit-kind=orc-lazy ClosedPublic Authored by StephenFan on Oct 2 2021, 2:40 AM.
Details Summary The bug was reported here https://bugs.llvm.org/show_bug.cgi?id=52030 This patch follows the idea that @lhames commented in the above webpage.
Diff Detail
Event TimelineStephenFan retitled this revision from [Orc] Fix destructor function support when --jit-kind=orc-lazy to [Orc] Fix global variable destructor function support when --jit-kind=orc-lazy.Oct 2 2021, 6:54 AM Comment Actions LGTM. Thanks Stephen!
This revision is now accepted and ready to land.Oct 2 2021, 10:48 AM Comment Actions Solves my original problem that lead to https://bugs.llvm.org/show_bug.cgi?id=52030. Thank you for working on this! StephenFan added inline comments.
Closed by commit rG02ac5e5cf129: [Orc] Fix global variable destructor function support when --jit-kind=orc-lazy (authored by StephenFan). · Explain WhyOct 9 2021, 12:58 AM This revision was automatically updated to reflect the committed changes. StephenFan marked an inline comment as done.
Revision Contents
Diff 377451 llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll
|
It would be good to use a DeInitFunctionPrefix here (along the same lines as InitFunctionPrefix).
Once the deinit functions are named with a known prefix we can look them up in GenericLLVMIRPlatformSupport::notifyAdding and add them to the DeInitFunctions map automatically. This will make destructors work from cached objects. This could be done in this patch, or in a follow-up.