diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp b/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp index b7890e7f0937..d6fe952c0c1d 100644 --- a/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp @@ -16,11 +16,14 @@ #include "llvm/MC/MCContext.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCSectionCOFF.h" +#include "llvm/MC/MCSectionDXContainer.h" #include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSectionGOFF.h" #include "llvm/MC/MCSectionMachO.h" +#include "llvm/MC/MCSectionSPIRV.h" #include "llvm/MC/MCSectionWasm.h" #include "llvm/MC/MCSectionXCOFF.h" +#include "llvm/Support/Casting.h" using namespace llvm; @@ -62,8 +65,18 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(const Triple &T) { (T.getArch() == Triple::aarch64 || T.getArch() == Triple::aarch64_32)) SupportsCompactUnwindWithoutEHFrame = true; - if (T.isWatchABI()) + switch (Ctx->emitDwarfUnwindInfo()) { + case EmitDwarfUnwindType::Always: + OmitDwarfIfHaveCompactUnwind = false; + break; + case EmitDwarfUnwindType::NoCompactUnwind: OmitDwarfIfHaveCompactUnwind = true; + break; + case EmitDwarfUnwindType::Default: + OmitDwarfIfHaveCompactUnwind = + T.isWatchABI() || SupportsCompactUnwindWithoutEHFrame; + break; + } FDECFIEncoding = dwarf::DW_EH_PE_pcrel; @@ -180,6 +193,9 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(const Triple &T) { MachO::S_THREAD_LOCAL_VARIABLE_POINTERS, SectionKind::getMetadata()); + AddrSigSection = Ctx->getMachOSection("__DATA", "__llvm_addrsig", 0, + SectionKind::getData()); + // Exception Handling. LSDASection = Ctx->getMachOSection("__TEXT", "__gcc_except_tab", 0, SectionKind::getReadOnlyWithRel()); @@ -518,8 +534,13 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(const Triple &T, bool Large) { } void MCObjectFileInfo::initGOFFMCObjectFileInfo(const Triple &T) { - TextSection = Ctx->getGOFFSection(".text", SectionKind::getText()); - BSSSection = Ctx->getGOFFSection(".bss", SectionKind::getBSS()); + TextSection = + Ctx->getGOFFSection(".text", SectionKind::getText(), nullptr, nullptr); + BSSSection = + Ctx->getGOFFSection(".bss", SectionKind::getBSS(), nullptr, nullptr); + PPA1Section = + Ctx->getGOFFSection(".ppa1", SectionKind::getMetadata(), TextSection, + MCConstantExpr::create(GOFF::SK_PPA1, *Ctx)); } void MCObjectFileInfo::initCOFFMCObjectFileInfo(const Triple &T) { @@ -554,8 +575,9 @@ void MCObjectFileInfo::initCOFFMCObjectFileInfo(const Triple &T) { ".rdata", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | COFF::IMAGE_SCN_MEM_READ, SectionKind::getReadOnly()); - if (T.getArch() == Triple::x86_64 || T.getArch() == Triple::aarch64) { - // On Windows 64 with SEH, the LSDA is emitted into the .xdata section + if (T.getArch() == Triple::x86_64 || T.getArch() == Triple::aarch64 || + T.getArch() == Triple::arm || T.getArch() == Triple::thumb) { + // On Windows with SEH, the LSDA is emitted into the .xdata section LSDASection = nullptr; } else { LSDASection = Ctx->getCOFFSection(".gcc_except_table", @@ -803,6 +825,11 @@ void MCObjectFileInfo::initCOFFMCObjectFileInfo(const Triple &T) { SectionKind::getReadOnly()); } +void MCObjectFileInfo::initSPIRVMCObjectFileInfo(const Triple &T) { + // Put everything in a single binary section. + TextSection = Ctx->getSPIRVSection(); +} + void MCObjectFileInfo::initWasmMCObjectFileInfo(const Triple &T) { TextSection = Ctx->getWasmSection(".text", SectionKind::getText()); DataSection = Ctx->getWasmSection(".data", SectionKind::getData()); @@ -993,7 +1020,12 @@ void MCObjectFileInfo::initXCOFFMCObjectFileInfo(const Triple &T) { /* MultiSymbolsAllowed */ true, ".dwmac", XCOFF::SSUBTYP_DWMAC); } -MCObjectFileInfo::~MCObjectFileInfo() {} +void MCObjectFileInfo::initDXContainerObjectFileInfo(const Triple &T) { + // At the moment the DXBC section should end up empty. + TextSection = Ctx->getDXContainerSection("DXBC", SectionKind::getText()); +} + +MCObjectFileInfo::~MCObjectFileInfo() = default; void MCObjectFileInfo::initMCObjectFileInfo(MCContext &MCCtx, bool PIC, bool LargeCodeModel) { @@ -1031,12 +1063,18 @@ void MCObjectFileInfo::initMCObjectFileInfo(MCContext &MCCtx, bool PIC, case MCContext::IsGOFF: initGOFFMCObjectFileInfo(TheTriple); break; + case MCContext::IsSPIRV: + initSPIRVMCObjectFileInfo(TheTriple); + break; case MCContext::IsWasm: initWasmMCObjectFileInfo(TheTriple); break; case MCContext::IsXCOFF: initXCOFFMCObjectFileInfo(TheTriple); break; + case MCContext::IsDXContainer: + initDXContainerObjectFileInfo(TheTriple); + break; } } @@ -1052,7 +1090,9 @@ MCSection *MCObjectFileInfo::getDwarfComdatSection(const char *Name, case Triple::MachO: case Triple::COFF: case Triple::GOFF: + case Triple::SPIRV: case Triple::XCOFF: + case Triple::DXContainer: case Triple::UnknownObjectFormat: report_fatal_error("Cannot get DWARF comdat section for this object file " "format: not implemented."); |