From 48079e0fef9301442eb787d2234ea99ba3f06fa8 Mon Sep 17 00:00:00 2001 From: Andrew Kaylor Date: Fri, 15 Nov 2013 17:52:54 +0000 Subject: Don't try to initialize memory for a global if the allocation failed in ExecutionEngine. Patch by Dale Martin! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194831 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ExecutionEngine/ExecutionEngine.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/ExecutionEngine') diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index a8de420..73bd43b 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -1289,6 +1289,10 @@ void ExecutionEngine::EmitGlobalVariable(const GlobalVariable *GV) { if (GA == 0) { // If it's not already specified, allocate memory for the global. GA = getMemoryForGV(GV); + + // If we failed to allocate memory for this global, return. + if (GA == 0) return; + addGlobalMapping(GV, GA); } -- cgit v1.1