From: Chris Lattner Date: Fri, 19 Nov 2004 08:44:07 +0000 (+0000) Subject: This is a horrible hack to work around libstdc++ bugs :( X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a98c5453b28b37c3fad118712ff4e634bfc36163;p=oota-llvm.git This is a horrible hack to work around libstdc++ bugs :( git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17988 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index 7fb4ad3ae81..812bec184d9 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -442,6 +442,9 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr, // void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) { if (isa(Init)) { + // FIXME: THIS SHOULD NOT BE NEEDED. + unsigned Size = getTargetData().getTypeSize(Init->getType()); + memset(Addr, 0, Size); return; } else if (Init->getType()->isFirstClassType()) { GenericValue Val = getConstantValue(Init); @@ -524,13 +527,14 @@ void ExecutionEngine::EmitGlobalVariable(const GlobalVariable *GV) { DEBUG(std::cerr << "Global '" << GV->getName() << "' -> " << GA << "\n"); const Type *ElTy = GV->getType()->getElementType(); + unsigned GVSize = getTargetData().getTypeSize(ElTy); if (GA == 0) { // If it's not already specified, allocate memory for the global. - GA = new char[getTargetData().getTypeSize(ElTy)]; + GA = new char[GVSize]; addGlobalMapping(GV, GA); } InitializeMemory(GV->getInitializer(), GA); - NumInitBytes += getTargetData().getTypeSize(ElTy); + NumInitBytes += GVSize; ++NumGlobals; }