From d5429f85e8636baa95451a6903b6a0ae8e7c3309 Mon Sep 17 00:00:00 2001 From: Yichao Yu Date: Tue, 11 Aug 2020 00:38:46 -0400 Subject: [PATCH] Allow inspecting LLVM code during imaging mode (#36974) --- src/aotcompile.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/aotcompile.cpp b/src/aotcompile.cpp index ba16df1414070..6b70547c25ed1 100644 --- a/src/aotcompile.cpp +++ b/src/aotcompile.cpp @@ -867,6 +867,11 @@ void *jl_get_llvmf_defn(jl_method_instance_t *mi, size_t world, char getwrapper, Function *F = NULL; if (m) { // if compilation succeeded, prepare to return the result + // For imaging mode, global constants are currently private without initializer + // which isn't legal. Convert them to extern linkage so that the code can compile + // and will better match what's actually in sysimg. + for (auto &global : output.globals) + global.second->setLinkage(GlobalValue::ExternalLinkage); if (optimize) PM->run(*m.get()); const std::string *fname;