summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
diff options
context:
space:
mode:
authorSean Fertile <sfertile@ca.ibm.com>2019-07-22 19:15:29 +0000
committerSean Fertile <sfertile@ca.ibm.com>2019-07-22 19:15:29 +0000
commit942537d9fa5026bb4780edfec695fb5bf497d369 (patch)
tree48f42cff722120e39192b9b15e8277a1b56295f6 /llvm/lib/MC
parentf6cd6ffbc9f8bfa0bbe25dba6a9737607a684bab (diff)
downloadbcm5719-llvm-942537d9fa5026bb4780edfec695fb5bf497d369.tar.gz
bcm5719-llvm-942537d9fa5026bb4780edfec695fb5bf497d369.zip
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
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r--llvm/lib/MC/MCAsmInfoXCOFF.cpp1
-rw-r--r--llvm/lib/MC/MCContext.cpp3
-rw-r--r--llvm/lib/MC/MCObjectFileInfo.cpp5
-rw-r--r--llvm/lib/MC/MCSectionXCOFF.cpp16
4 files changed, 21 insertions, 4 deletions
diff --git a/llvm/lib/MC/MCAsmInfoXCOFF.cpp b/llvm/lib/MC/MCAsmInfoXCOFF.cpp
index 74c21f0c9e6..6a9bef6adff 100644
--- a/llvm/lib/MC/MCAsmInfoXCOFF.cpp
+++ b/llvm/lib/MC/MCAsmInfoXCOFF.cpp
@@ -15,4 +15,5 @@ void MCAsmInfoXCOFF::anchor() {}
MCAsmInfoXCOFF::MCAsmInfoXCOFF() {
IsLittleEndian = false;
HasDotTypeDotSizeDirective = false;
+ COMMDirectiveAlignmentIsInBytes = false;
}
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 0dc2e2d37ca..ecd12fdc689 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -531,6 +531,7 @@ MCSectionWasm *MCContext::getWasmSection(const Twine &Section, SectionKind Kind,
MCSectionXCOFF *MCContext::getXCOFFSection(StringRef Section,
XCOFF::StorageMappingClass SMC,
+ XCOFF::SymbolType Type,
SectionKind Kind,
const char *BeginSymName) {
// Do the lookup. If we have a hit, return it.
@@ -548,7 +549,7 @@ MCSectionXCOFF *MCContext::getXCOFFSection(StringRef Section,
Begin = createTempSymbol(BeginSymName, false);
MCSectionXCOFF *Result = new (XCOFFAllocator.Allocate())
- MCSectionXCOFF(CachedName, SMC, Kind, Begin);
+ MCSectionXCOFF(CachedName, SMC, Type, Kind, Begin);
Entry.second = Result;
auto *F = new MCDataFragment();
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index 9f555abe140..6dc0e38e8e8 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -767,8 +767,9 @@ void MCObjectFileInfo::initXCOFFMCObjectFileInfo(const Triple &T) {
// get placed into this csect. The choice of csect name is not a property of
// the ABI or object file format. For example, the XL compiler uses an unnamed
// csect for program code.
- TextSection = Ctx->getXCOFFSection(
- ".text", XCOFF::StorageMappingClass::XMC_PR, SectionKind::getText());
+ TextSection =
+ Ctx->getXCOFFSection(".text", XCOFF::StorageMappingClass::XMC_PR,
+ XCOFF::XTY_SD, SectionKind::getText());
}
void MCObjectFileInfo::InitMCObjectFileInfo(const Triple &TheTriple, bool PIC,
diff --git a/llvm/lib/MC/MCSectionXCOFF.cpp b/llvm/lib/MC/MCSectionXCOFF.cpp
index d1a63734502..740365f0476 100644
--- a/llvm/lib/MC/MCSectionXCOFF.cpp
+++ b/llvm/lib/MC/MCSectionXCOFF.cpp
@@ -19,15 +19,29 @@ void MCSectionXCOFF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
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; }
OpenPOWER on IntegriCloud