From ddbde9a4add367c12b4ff8bda5e7a6b351b645c6 Mon Sep 17 00:00:00 2001 From: Paul Robinson Date: Fri, 9 Nov 2018 19:06:09 +0000 Subject: [DWARFv5] Emit normal type units in .debug_info comdats. Differential Revision: https://reviews.llvm.org/D54282 llvm-svn: 346540 --- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 7 ++++++- llvm/lib/MC/MCObjectFileInfo.cpp | 9 +++++---- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 070b8fe4ec1..5d50f34d77d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2610,9 +2610,14 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU, Ins.first->second = Signature; if (useSplitDwarf()) + // FIXME: v5 split type units belong in .debug_info.dwo. NewTU.setSection(Asm->getObjFileLowering().getDwarfTypesDWOSection()); else { - NewTU.setSection(Asm->getObjFileLowering().getDwarfTypesSection(Signature)); + MCSection *Section = + getDwarfVersion() <= 4 + ? Asm->getObjFileLowering().getDwarfTypesSection(Signature) + : Asm->getObjFileLowering().getDwarfInfoSection(Signature); + NewTU.setSection(Section); // Non-split type units reuse the compile unit's line table. CU.applyStmtList(UnitDie); } diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp index ab8e0f31db9..0513ba5a82a 100644 --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -812,16 +812,17 @@ void MCObjectFileInfo::InitMCObjectFileInfo(const Triple &TheTriple, bool PIC, } } -MCSection *MCObjectFileInfo::getDwarfTypesSection(uint64_t Hash) const { +MCSection *MCObjectFileInfo::getDwarfComdatSection(const char *Name, + uint64_t Hash) const { switch (TT.getObjectFormat()) { case Triple::ELF: - return Ctx->getELFSection(".debug_types", ELF::SHT_PROGBITS, ELF::SHF_GROUP, - 0, utostr(Hash)); + return Ctx->getELFSection(Name, ELF::SHT_PROGBITS, ELF::SHF_GROUP, 0, + utostr(Hash)); case Triple::MachO: case Triple::COFF: case Triple::Wasm: case Triple::UnknownObjectFormat: - report_fatal_error("Cannot get DWARF types section for this object file " + report_fatal_error("Cannot get DWARF comdat section for this object file " "format: not implemented."); break; } -- cgit v1.2.3