summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCObjectFileInfo.cpp
diff options
context:
space:
mode:
authorSean Fertile <sfertile@ca.ibm.com>2019-07-09 19:21:01 +0000
committerSean Fertile <sfertile@ca.ibm.com>2019-07-09 19:21:01 +0000
commitf09d54ed2a75b62960b35258136435d7c8d418e1 (patch)
tree5f727b7c433f9026cf64e6ec03d25e11d306994d /llvm/lib/MC/MCObjectFileInfo.cpp
parent294f37561ab155e363be0fca5fa43528d8b29d18 (diff)
downloadbcm5719-llvm-f09d54ed2a75b62960b35258136435d7c8d418e1.tar.gz
bcm5719-llvm-f09d54ed2a75b62960b35258136435d7c8d418e1.zip
Boilerplate for producing XCOFF object files from the PowerPC backend.
Stubs out a number of the classes needed to produce a new object file format (XCOFF) for the powerpc-aix target. For testing input is an empty module which produces an object file with just a file header. Differential Revision: https://reviews.llvm.org/D61694 llvm-svn: 365541
Diffstat (limited to 'llvm/lib/MC/MCObjectFileInfo.cpp')
-rw-r--r--llvm/lib/MC/MCObjectFileInfo.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index 0faa236c153..9f555abe140 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -18,6 +18,7 @@
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCSectionWasm.h"
+#include "llvm/MC/MCSectionXCOFF.h"
using namespace llvm;
@@ -761,6 +762,15 @@ void MCObjectFileInfo::initWasmMCObjectFileInfo(const Triple &T) {
// TODO: Define more sections.
}
+void MCObjectFileInfo::initXCOFFMCObjectFileInfo(const Triple &T) {
+ // The default csect for program code. Functions without a specified section
+ // 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());
+}
+
void MCObjectFileInfo::InitMCObjectFileInfo(const Triple &TheTriple, bool PIC,
MCContext &ctx,
bool LargeCodeModel) {
@@ -809,8 +819,7 @@ void MCObjectFileInfo::InitMCObjectFileInfo(const Triple &TheTriple, bool PIC,
break;
case Triple::XCOFF:
Env = IsXCOFF;
- // TODO: Initialize MCObjectFileInfo for XCOFF format when
- // MCSectionXCOFF is ready.
+ initXCOFFMCObjectFileInfo(TT);
break;
case Triple::UnknownObjectFormat:
report_fatal_error("Cannot initialize MC for unknown object file format.");
OpenPOWER on IntegriCloud