Windows needs more symbols to be injected:

such as __dllonexit() and _onexit(). Without, static destruction
does not happen, as can be seen by roottest/cling/staticinit/execROOT-7775.C
failing to call the static destructors.
This commit is contained in:
Axel Naumann 2021-02-24 18:17:57 +01:00 committed by jenkins
parent b5348025ef
commit 7c83a3e0ae

View File

@ -312,13 +312,25 @@ namespace cling {
// Now that the transactions have been commited, force symbol emission
// and overrides.
if (!isInSyntaxOnlyMode() && !m_Opts.CompilerOpts.CUDADevice) {
if (void* Addr = m_Executor->getPointerToGlobalFromJIT("at_quick_exit"))
m_Executor->addSymbol("at_quick_exit", Addr, true);
// libstdc++ mangles at_quick_exit on Linux when g++ < 5
else if (void* Addr = m_Executor->getPointerToGlobalFromJIT("_Z13at_quick_exitPFvvE"))
m_Executor->addSymbol("_Z13at_quick_exitPFvvE", Addr, true);
else
cling::errs() << "'at_quick_exit' not defined\n";
if (const Transaction* T = getLastTransaction()) {
if (auto M = T->getModule()) {
for (const llvm::StringRef& Sym : Syms) {
const llvm::GlobalValue* GV = M->getNamedValue(Sym);
#if defined(__linux__)
// libstdc++ mangles at_quick_exit on Linux when g++ < 5
if (!GV && Sym.equals("at_quick_exit"))
GV = M->getNamedValue("_Z13at_quick_exitPFvvE");
#endif
if (GV) {
if (void* Addr = m_Executor->getPointerToGlobalFromJIT(Sym))
m_Executor->addSymbol(Sym.str().c_str(), Addr, true);
else
cling::errs() << Sym << " not defined\n";
} else
cling::errs() << Sym << " not in Module!\n";
}
}
}
}
m_IncrParser->SetTransformers(parentInterp);