Stubs out TLOF for AIX and add support for common vars in assembly output.
Stubs out a TargetLoweringObjectFileXCOFF class, implementing only
SelectSectionForGlobal for common symbols. Also adds an override of
EmitGlobalVariable in PPCAIXAsmPrinter which adds a number of defensive errors
and adds support for emitting common globals.
llvm-svn: 366727
diff --git a/llvm/lib/MC/MCSectionXCOFF.cpp b/llvm/lib/MC/MCSectionXCOFF.cpp
index d1a6373..740365f 100644
--- a/llvm/lib/MC/MCSectionXCOFF.cpp
+++ b/llvm/lib/MC/MCSectionXCOFF.cpp
@@ -19,15 +19,29 @@
raw_ostream &OS,
const MCExpr *Subsection) const {
if (getKind().isText()) {
+ if (getMappingClass() != XCOFF::XMC_PR)
+ llvm_unreachable("Unsupported storage-mapping class for .text csect");
+
OS << "\t.csect " << getSectionName() << "["
<< "PR"
<< "]" << '\n';
return;
}
+ if (getKind().isCommon()) {
+ if (getMappingClass() != XCOFF::XMC_RW)
+ llvm_unreachable("Unsupported storage-mapping class for common csect");
+ if (getCSectType() != XCOFF::XTY_CM)
+ llvm_unreachable("wrong csect type for common csect");
+ // Don't have to print a directive for switching to section for commons.
+ // '.comm' and '.lcomm' directives for the variable will create the needed
+ // csect.
+ return;
+ }
+
report_fatal_error("Printing for this SectionKind is unimplemented.");
}
bool MCSectionXCOFF::UseCodeAlign() const { return getKind().isText(); }
-bool MCSectionXCOFF::isVirtualSection() const { return !getKind().isCommon(); }
+bool MCSectionXCOFF::isVirtualSection() const { return XCOFF::XTY_CM == Type; }