diff options
author | Dale Johannesen <dalej@apple.com> | 2008-05-23 00:16:59 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2008-05-23 00:16:59 +0000 |
commit | bbcb34cafb1da98ff4bdb097020d252216c7627c (patch) | |
tree | 369e00534ba17ae6a0aa09a0bfcb14fdcef76369 | |
parent | ed1ec3aa6b646a47943fdbdf6148c342f0b5a31f (diff) |
Put const weak stuff in appropriate section on Darwin.
g++.dg/abi/key2.C
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51458 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/X86AsmPrinter.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index caccf52b07..9f3f76956d 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -251,7 +251,15 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { if (Subtarget->isTargetDarwin()) { O << "\t.globl " << name << "\n" << TAI->getWeakDefDirective() << 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); + } } else if (Subtarget->isTargetCygMing()) { std::string SectionName(".section\t.data$linkonce." + name + |