From b1528b26db88617846408997dbdf4ce8972f7c0a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 4 Jan 2009 20:19:20 +0000 Subject: [PATCH] elf writer really wants the size of the global, not the size of the pointer to the global. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61630 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/ELFWriter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp index 683a21e5e49..f0da37aca36 100644 --- a/lib/CodeGen/ELFWriter.cpp +++ b/lib/CodeGen/ELFWriter.cpp @@ -34,7 +34,7 @@ #include "ELFWriter.h" #include "llvm/Module.h" #include "llvm/PassManager.h" -#include "llvm/Type.h" // FIXME: For PATypeHolder::get(). +#include "llvm/DerivedTypes.h" #include "llvm/CodeGen/FileWriters.h" #include "llvm/CodeGen/MachineCodeEmitter.h" #include "llvm/CodeGen/MachineConstantPool.h" @@ -274,9 +274,9 @@ void ELFWriter::EmitGlobal(GlobalVariable *GV) { return; } - const Type *GVType = (const Type*)GV->getType(); unsigned Align = TM.getTargetData()->getPreferredAlignment(GV); - unsigned Size = TM.getTargetData()->getABITypeSize(GVType); + unsigned Size = + TM.getTargetData()->getABITypeSize(GV->getType()->getElementType()); // If this global has a zero initializer, it is part of the .bss or common // section. -- 2.11.0