From 18cc4d3ea4f9c86e1e0ce67cefb1f2e23d0619f2 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Sat, 24 May 2008 00:10:20 +0000 Subject: Put initialized const weak objects into correct sections on ppc32 darwin. g++.dg/abi/key2.C llvm-svn: 51527 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp') diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp index 75bf3b36e3f..9c9dd391be7 100644 --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -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(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 -- cgit v1.2.3