[PATCH] D70182: Add read-only data assembly writing
Digger via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 15 08:36:16 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3dfa975fb36f: Add read-only data assembly writing for aix (authored by DiggerLin).
Changed prior to commit:
https://reviews.llvm.org/D70182?vs=229377&id=229561#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70182/new/
https://reviews.llvm.org/D70182
Files:
llvm/lib/BinaryFormat/XCOFF.cpp
llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/lib/MC/MCObjectFileInfo.cpp
llvm/lib/MC/MCSectionXCOFF.cpp
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -1747,7 +1747,9 @@
report_fatal_error("COMDAT not yet supported by AIX.");
SectionKind GVKind = getObjFileLowering().getKindForGlobal(GV, TM);
- if (!GVKind.isCommon() && !GVKind.isBSS() && !GVKind.isData())
+ if ((!GVKind.isCommon() && !GVKind.isBSS() && !GVKind.isData() &&
+ !GVKind.isReadOnly()) ||
+ GVKind.isMergeableCString() || GVKind.isMergeableConst())
report_fatal_error("Encountered a global variable kind that is "
"not supported yet.");
Index: llvm/lib/MC/MCSectionXCOFF.cpp
===================================================================
--- llvm/lib/MC/MCSectionXCOFF.cpp
+++ llvm/lib/MC/MCSectionXCOFF.cpp
@@ -27,6 +27,13 @@
return;
}
+ if (getKind().isReadOnly()) {
+ if (getMappingClass() != XCOFF::XMC_RO)
+ report_fatal_error("Unhandled storage-mapping class for .rodata csect.");
+ OS << "\t.csect " << QualName->getName() << '\n';
+ return;
+ }
+
if (getKind().isData()) {
switch (getMappingClass()) {
case XCOFF::XMC_RW:
Index: llvm/lib/MC/MCObjectFileInfo.cpp
===================================================================
--- llvm/lib/MC/MCObjectFileInfo.cpp
+++ llvm/lib/MC/MCObjectFileInfo.cpp
@@ -777,6 +777,10 @@
DataSection = Ctx->getXCOFFSection(
".data", XCOFF::StorageMappingClass::XMC_RW, XCOFF::XTY_SD,
XCOFF::C_HIDEXT, SectionKind::getData());
+
+ ReadOnlySection = Ctx->getXCOFFSection(
+ ".rodata", XCOFF::StorageMappingClass::XMC_RO, XCOFF::XTY_SD,
+ XCOFF::C_HIDEXT, SectionKind::getReadOnly());
}
void MCObjectFileInfo::InitMCObjectFileInfo(const Triple &TheTriple, bool PIC,
Index: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
===================================================================
--- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -1861,6 +1861,10 @@
if (Kind.isBSS())
return DataSection;
+ if (Kind.isReadOnly() && !Kind.isMergeableConst() &&
+ !Kind.isMergeableCString())
+ return ReadOnlySection;
+
report_fatal_error("XCOFF other section types not yet implemented.");
}
Index: llvm/lib/BinaryFormat/XCOFF.cpp
===================================================================
--- llvm/lib/BinaryFormat/XCOFF.cpp
+++ llvm/lib/BinaryFormat/XCOFF.cpp
@@ -22,6 +22,8 @@
return "TC0";
case XCOFF::XMC_BS:
return "BS";
+ case XCOFF::XMC_RO:
+ return "RO";
default:
report_fatal_error("Unhandled storage-mapping class.");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70182.229561.patch
Type: text/x-patch
Size: 2744 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191115/5d49be03/attachment-0001.bin>
More information about the llvm-commits
mailing list