diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 22 | ||||
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 3 |
2 files changed, 22 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 5d5f77b83ef..34ed476112f 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -1849,6 +1849,24 @@ MCSection *TargetLoweringObjectFileXCOFF::SelectSectionForGlobal( SC, Kind, /* BeginSymbolName */ nullptr); } + if (Kind.isMergeableCString()) { + if (!Kind.isMergeable1ByteCString()) + report_fatal_error("Unhandled multi-byte mergeable string kind."); + + unsigned Align = GO->getParent()->getDataLayout().getPreferredAlignment( + cast<GlobalVariable>(GO)); + + unsigned EntrySize = getEntrySizeForKind(Kind); + std::string SizeSpec = ".rodata.str" + utostr(EntrySize) + "."; + SmallString<128> Name; + Name = SizeSpec + utostr(Align); + + return getContext().getXCOFFSection( + Name, XCOFF::XMC_RO, XCOFF::XTY_SD, + TargetLoweringObjectFileXCOFF::getStorageClassForGlobal(GO), + Kind, /* BeginSymbolName */ nullptr); + } + if (Kind.isText()) return TextSection; @@ -1861,8 +1879,7 @@ MCSection *TargetLoweringObjectFileXCOFF::SelectSectionForGlobal( if (Kind.isBSS()) return DataSection; - if (Kind.isReadOnly() && !Kind.isMergeableConst() && - !Kind.isMergeableCString()) + if (Kind.isReadOnly() && !Kind.isMergeableConst()) return ReadOnlySection; report_fatal_error("XCOFF other section types not yet implemented."); @@ -1920,6 +1937,7 @@ XCOFF::StorageClass TargetLoweringObjectFileXCOFF::getStorageClassForGlobal( const GlobalObject *GO) { switch (GO->getLinkage()) { case GlobalValue::InternalLinkage: + case GlobalValue::PrivateLinkage: return XCOFF::C_HIDEXT; case GlobalValue::ExternalLinkage: case GlobalValue::CommonLinkage: diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp index e4b3d468476..1b1d27ee3cc 100644 --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -1749,7 +1749,8 @@ void PPCAIXAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) { SectionKind GVKind = getObjFileLowering().getKindForGlobal(GV, TM); if ((!GVKind.isCommon() && !GVKind.isBSS() && !GVKind.isData() && !GVKind.isReadOnly()) || - GVKind.isMergeableCString() || GVKind.isMergeableConst()) + GVKind.isMergeable2ByteCString() || GVKind.isMergeable4ByteCString() || + GVKind.isMergeableConst()) report_fatal_error("Encountered a global variable kind that is " "not supported yet."); |

