From adae9bfa243713a781ecad6e07759e57dc2c7f52 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Mon, 2 Jul 2018 22:30:18 +0000 Subject: [ORC] Verify modules when running LLLazyJIT in LLI, and deal with fallout. The verifier identified several modules that were broken due to incorrect linkage on declarations. To fix this, CompileOnDemandLayer2::extractFunction has been updated to change decls to external linkage. llvm-svn: 336150 --- llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'llvm/lib/ExecutionEngine') diff --git a/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp b/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp index 27a4ad68f59..f7ff40cf802 100644 --- a/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp +++ b/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp @@ -322,11 +322,15 @@ std::unique_ptr CompileOnDemandLayer2::extractFunctions( ValueToValueMapTy VMap; auto Materializer = createLambdaValueMaterializer([&](Value *V) -> Value * { + GlobalValue *NewGV = nullptr; if (auto *F = dyn_cast(V)) - return cloneFunctionDecl(*ExtractedFunctionsModule, *F); + NewGV = cloneFunctionDecl(*ExtractedFunctionsModule, *F); else if (auto *GV = dyn_cast(V)) - return cloneGlobalVariableDecl(*ExtractedFunctionsModule, *GV); - return nullptr; + NewGV = cloneGlobalVariableDecl(*ExtractedFunctionsModule, *GV); + + if (NewGV) + NewGV->setLinkage(GlobalValue::ExternalLinkage); + return NewGV; }); std::vector> OrigToNew; -- cgit v1.2.3