diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp index a7086975f056..bfea893a9b2c 100644 --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -548,6 +548,14 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { O << "\t.globl " << name << "\n"; // FALL THROUGH case GlobalValue::InternalLinkage: + if (TAI->getCStringSection()) { + const ConstantArray *CVA = dyn_cast(C); + if (CVA && CVA->isCString()) { + SwitchToDataSection(TAI->getCStringSection(), I); + break; + } + } + SwitchToDataSection("\t.data", I); break; default: diff --git a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp index cecffbabf1cd..f8848f592c55 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp @@ -28,6 +28,7 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) { AlignmentIsInBytes = false; ConstantPoolSection = "\t.const\t"; JumpTableDataSection = ".const"; + CStringSection = "\t.cstring"; LCOMMDirective = "\t.lcomm\t"; StaticCtorsSection = ".mod_init_func"; StaticDtorsSection = ".mod_term_func";