зеркало из https://github.com/microsoft/clang-1.git
"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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52680 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
be78424edf
Коммит
4e0b2641d8
|
@ -755,10 +755,12 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
|
|||
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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче