aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-05-24 00:10:20 +0000
committerDale Johannesen <dalej@apple.com>2008-05-24 00:10:20 +0000
commit1c36512c04711a919a705d982aee832041d86bef (patch)
tree9f6ea308ff46fe53819a0670b95555b7a7787a4c /lib/Target
parentd5cbf3aa26d146b34c84663fcbd0d3161df70809 (diff)
downloadexternal_llvm-1c36512c04711a919a705d982aee832041d86bef.zip
external_llvm-1c36512c04711a919a705d982aee832041d86bef.tar.gz
external_llvm-1c36512c04711a919a705d982aee832041d86bef.tar.bz2
Put initialized const weak objects into correct
sections on ppc32 darwin. g++.dg/abi/key2.C git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51527 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-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 75bf3b3..9c9dd39 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