Put initialized const weak objects into correct

sections on ppc32 darwin.  g++.dg/abi/key2.C

llvm-svn: 51527
This commit is contained in:
Dale Johannesen 2008-05-24 00:10:20 +00:00
parent 8647b875cc
commit 18cc4d3ea4
1 changed files with 9 additions and 1 deletions

View File

@ -977,7 +977,15 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
case GlobalValue::CommonLinkage:
O << "\t.globl " << name << '\n'
<< "\t.weak_definition " << name << '\n';
SwitchToDataSection("\t.section __DATA,__datacoal_nt,coalesced", I);
if (!I->isConstant())
SwitchToDataSection("\t.section __DATA,__datacoal_nt,coalesced", I);
else {
const ArrayType *AT = dyn_cast<ArrayType>(Type);
if (AT && AT->getElementType()==Type::Int8Ty)
SwitchToDataSection("\t.section __TEXT,__const_coal,coalesced", I);
else
SwitchToDataSection("\t.section __DATA,__const_coal,coalesced", I);
}
break;
case GlobalValue::AppendingLinkage:
// FIXME: appending linkage variables should go into a section of