-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Description
So I have a program that highly resembles the LLJITWithInitializers.cpp example except that we expose all symbols in process memory to JIT space.
Recently we're upgrading from LLVM-15 to LLVM-17 and found that our unit tests involving static dtors are broken. It appears that
- static dtors in JITed module don't run anymore with LLJIT::deinitialize(JD)
- Something generated by JIT is attached to the real __cxa_atexit() which causes segfault during shutdown.
Static ctors seem fine.
I was looking through the commits in Orc but too many to find something relevant.
Then I searched __cxa_atexit in the repo and found this comment about LocalCXXRuntimeOverrides in ExecutionUtils.h which seems to describe exactly what's happening. With LLJIT most details are sealed and we only call the clean interface.
I tried to do CXXRuntimeoverrides.enable(llJIT_->getMainJITDylib(), *mangle_)
but got Duplicate definition of symbol '__dso_handle'
for now. Still looking.
Platform is Linux x86_64.
I'm running out of ideas so wonder if any expert is aware of some changes to LLJIT that require users to do something different / explicit to handle static dtors or atexit() gracefully. Any help is super appreciated. Thank you!