aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCObjectFileInfo.cpp
diff options
context:
space:
mode:
authorDavid Tenty <daltenty@ibm.com>2020-01-22 11:09:34 -0500
committerDavid Tenty <daltenty@ibm.com>2020-01-22 12:09:11 -0500
commit45a4aaea7fdf21a139b35ad6d25f6c4a150e065f (patch)
tree08038ec2d516ec723830f6f4b38f1cb1e89e4721 /llvm/lib/MC/MCObjectFileInfo.cpp
parent2d0fcf786c5c7f384e30a955d2e7da46d1f98949 (diff)
downloadllvm-45a4aaea7fdf21a139b35ad6d25f6c4a150e065f.zip
llvm-45a4aaea7fdf21a139b35ad6d25f6c4a150e065f.tar.gz
llvm-45a4aaea7fdf21a139b35ad6d25f6c4a150e065f.tar.bz2
[NFC][XCOFF] Refactor Csect creation into TargetLoweringObjectFile
Summary: We create a number of standard types of control sections in multiple places for things like the function descriptors, external references and the TOC anchor among others, so it is possible for their properties to be defined inconsistently in different places. This refactor moves their creation and properties into functions in the TargetLoweringObjectFile class hierarchy, where functions for retrieving various special types of sections typically seem to reside. Note: There is one case in PPCISelLowering which is specific to function entry points which we don't address since we don't have access to the TLOF there. Reviewers: DiggerLin, jasonliu, hubert.reinterpretcast Reviewed By: jasonliu, hubert.reinterpretcast Subscribers: wuzish, nemanjai, hiraditya, kbarton, jsji, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72347
Diffstat (limited to 'llvm/lib/MC/MCObjectFileInfo.cpp')
-rw-r--r--llvm/lib/MC/MCObjectFileInfo.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index d567cc1..f339bcf 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -795,6 +795,13 @@ void MCObjectFileInfo::initXCOFFMCObjectFileInfo(const Triple &T) {
ReadOnlySection = Ctx->getXCOFFSection(
".rodata", XCOFF::StorageMappingClass::XMC_RO, XCOFF::XTY_SD,
XCOFF::C_HIDEXT, SectionKind::getReadOnly());
+
+ TOCBaseSection = Ctx->getXCOFFSection(
+ "TOC", XCOFF::StorageMappingClass::XMC_TC0, XCOFF::XTY_SD,
+ XCOFF::C_HIDEXT, SectionKind::getData());
+
+ // The TOC-base always has 0 size, but 4 byte alignment.
+ TOCBaseSection->setAlignment(Align(4));
}
void MCObjectFileInfo::InitMCObjectFileInfo(const Triple &TheTriple, bool PIC,