diff options
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp index e16303e888d..7f57f69656f 100644 --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -701,7 +701,10 @@ bool LinuxAsmPrinter::doFinalization(Module &M) { + ",\"aw\",@progbits"; SwitchToDataSection(SectionName.c_str()); } else { - SwitchToDataSection(TAI->getDataSection(), I); + if (I->isConstant() && TAI->getReadOnlySection()) + SwitchToDataSection(TAI->getReadOnlySection(), I); + else + SwitchToDataSection(TAI->getDataSection(), I); } break; default: @@ -942,17 +945,17 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { SwitchToDataSection(TAI->getDataSection(), I); else { // Read-only data. - bool isIntFPLiteral = Type->isInteger() || Type->isFloatingPoint(); - if (C->ContainsRelocations() && + bool HasReloc = C->ContainsRelocations(); + if (HasReloc && TM.getRelocationModel() != Reloc::Static) SwitchToDataSection("\t.const_data\n"); - else if (isIntFPLiteral && Size == 4 && + else if (!HasReloc && Size == 4 && TAI->getFourByteConstantSection()) SwitchToDataSection(TAI->getFourByteConstantSection(), I); - else if (isIntFPLiteral && Size == 8 && + else if (!HasReloc && Size == 8 && TAI->getEightByteConstantSection()) SwitchToDataSection(TAI->getEightByteConstantSection(), I); - else if (isIntFPLiteral && Size == 16 && + else if (!HasReloc && Size == 16 && TAI->getSixteenByteConstantSection()) SwitchToDataSection(TAI->getSixteenByteConstantSection(), I); else if (TAI->getReadOnlySection()) |