[cfe-commits] r52680 - /cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
Chris Lattner
sabre at nondot.org
Tue Jun 24 10:01:28 PDT 2008
Author: lattner
Date: Tue Jun 24 12:01:28 2008
New Revision: 52680
URL: http://llvm.org/viewvc/llvm-project?rev=52680&view=rev
Log:
"This is a small fix for a bug where static object instances were being incorrectly generated. The bug was caused by my inability to read the GNU libobjc source and is only apparent when JITing code (static compilation does not expose the bug due to the data layout of other globals)."
Patch by David Chisnall!
Modified:
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=52680&r1=52679&r2=52680&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Tue Jun 24 12:01:28 2008
@@ -755,10 +755,12 @@
llvm::StructType::get(PtrToInt8Ty, StaticsArrayTy, NULL);
llvm::Constant *Statics =
MakeGlobal(StaticsListTy, Elements, ".objc_statics");
- Statics = new
- llvm::GlobalVariable(llvm::PointerType::getUnqual(StaticsListTy), false,
- llvm::GlobalValue::InternalLinkage, Statics, ".objc_statics_ptr",
- &TheModule);
+ llvm::ArrayType *StaticsListArrayTy =
+ llvm::ArrayType::get(llvm::PointerType::getUnqual(StaticsListTy), 2);
+ Elements.clear();
+ Elements.push_back(Statics);
+ Elements.push_back(llvm::ConstantPointerNull::get(llvm::PointerType::getUnqual(StaticsListTy)));
+ Statics = MakeGlobal(StaticsListArrayTy, Elements, ".objc_statics_ptr");
Statics = llvm::ConstantExpr::getBitCast(Statics, PtrTy);
// Array of classes, categories, and constant objects
llvm::ArrayType *ClassListTy = llvm::ArrayType::get(PtrToInt8Ty,
More information about the cfe-commits
mailing list