aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MCObjectFileInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MC/MCObjectFileInfo.cpp')
-rw-r--r--lib/MC/MCObjectFileInfo.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/lib/MC/MCObjectFileInfo.cpp b/lib/MC/MCObjectFileInfo.cpp
index 9e35355d06e0..9f555abe1404 100644
--- a/lib/MC/MCObjectFileInfo.cpp
+++ b/lib/MC/MCObjectFileInfo.cpp
@@ -1,9 +1,8 @@
//===-- MCObjectFileInfo.cpp - Object File Information --------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -19,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;
@@ -291,6 +291,9 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(const Triple &T) {
FaultMapSection = Ctx->getMachOSection("__LLVM_FAULTMAPS", "__llvm_faultmaps",
0, SectionKind::getMetadata());
+ RemarksSection = Ctx->getMachOSection(
+ "__LLVM", "__remarks", MachO::S_ATTR_DEBUG, SectionKind::getMetadata());
+
TLSExtraDataSection = TLSTLVSection;
}
@@ -476,6 +479,9 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(const Triple &T, bool Large) {
Ctx->getELFSection(".eh_frame", EHSectionType, EHSectionFlags);
StackSizesSection = Ctx->getELFSection(".stack_sizes", ELF::SHT_PROGBITS, 0);
+
+ RemarksSection =
+ Ctx->getELFSection(".remarks", ELF::SHT_PROGBITS, ELF::SHF_EXCLUDE);
}
void MCObjectFileInfo::initCOFFMCObjectFileInfo(const Triple &T) {
@@ -756,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) {
@@ -802,6 +817,10 @@ void MCObjectFileInfo::InitMCObjectFileInfo(const Triple &TheTriple, bool PIC,
Env = IsWasm;
initWasmMCObjectFileInfo(TT);
break;
+ case Triple::XCOFF:
+ Env = IsXCOFF;
+ initXCOFFMCObjectFileInfo(TT);
+ break;
case Triple::UnknownObjectFormat:
report_fatal_error("Cannot initialize MC for unknown object file format.");
break;
@@ -817,6 +836,7 @@ MCSection *MCObjectFileInfo::getDwarfComdatSection(const char *Name,
case Triple::MachO:
case Triple::COFF:
case Triple::Wasm:
+ case Triple::XCOFF:
case Triple::UnknownObjectFormat:
report_fatal_error("Cannot get DWARF comdat section for this object file "
"format: not implemented.");