From 00bbb8e08194015e41422ddbcd1b84b046908551 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Mon, 9 Aug 2021 17:13:55 +0200 Subject: [PATCH] Windows: always emit definitions of JITed "weak" variables Fixes test failures (crashes) in projectroot.test.test_stressiterators_interpreted projectroot.roottest.cling.dict.roottest_cling_dict_assertTmpltDefArgCtor projectroot.test.test_stresshistogram_interpreted projectroot.roottest.root.meta.roottest_root_meta_runnamespace_auto --- lib/Interpreter/BackendPasses.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Interpreter/BackendPasses.cpp b/lib/Interpreter/BackendPasses.cpp index f2eba89e..2c3cdd9a 100644 --- a/lib/Interpreter/BackendPasses.cpp +++ b/lib/Interpreter/BackendPasses.cpp @@ -140,9 +140,14 @@ namespace { // Find the symbol in JIT or shared libraries. if (m_JIT.getSymbolAddress(GV.getName(), /*AlsoInProcess*/ true)) { +#if !defined(_WIN32) + // Heuristically, Windows cannot handle cross-library variables; they + // must be library-local. if (auto *Var = dyn_cast(&GV)) { Var->setInitializer(nullptr); // make this a declaration - } else if (auto *Func = dyn_cast(&GV)) { + } else +#endif + if (auto *Func = dyn_cast(&GV)) { Func->deleteBody(); // make this a declaration } else { llvm_unreachable("What is this?");