aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Target/PowerPC/PPCAsmPrinter.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 75bf3b36e3..9c9dd391be 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/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<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