diff --git a/llvm/include/llvm/BinaryFormat/XCOFF.h b/llvm/include/llvm/BinaryFormat/XCOFF.h --- a/llvm/include/llvm/BinaryFormat/XCOFF.h +++ b/llvm/include/llvm/BinaryFormat/XCOFF.h @@ -78,6 +78,24 @@ STYP_OVRFLO = 0x8000 }; +/// Values for defining the section subtype of sections of type STYP_DWARF as +/// they would appear in the (signed, 32-bit) s_flags field of the section +/// header structure, contributing to the 16 most significant bits. Defined in +/// the system header `scnhdr.h`. +enum DwarfSectionSubtypeFlags : int32_t { + SSUBTYP_DWINFO = 0x1'0000, ///< DWARF info section + SSUBTYP_DWLINE = 0x2'0000, ///< DWARF line section + SSUBTYP_DWPBNMS = 0x3'0000, ///< DWARF pubnames section + SSUBTYP_DWPBTYP = 0x4'0000, ///< DWARF pubtypes section + SSUBTYP_DWARNGE = 0x5'0000, ///< DWARF aranges section + SSUBTYP_DWABREV = 0x6'0000, ///< DWARF abbrev section + SSUBTYP_DWSTR = 0x7'0000, ///< DWARF str section + SSUBTYP_DWRNGES = 0x8'0000, ///< DWARF ranges section + SSUBTYP_DWLOC = 0x9'0000, ///< DWARF loc section + SSUBTYP_DWFRAME = 0xA'0000, ///< DWARF frame section + SSUBTYP_DWMAC = 0xB'0000 ///< DWARF macinfo section +}; + // STORAGE CLASSES, n_sclass field of syment. // The values come from `storclass.h` and `dbxstclass.h`. enum StorageClass : uint8_t { diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -833,6 +833,22 @@ // The TOC-base always has 0 size, but 4 byte alignment. TOCBaseSection->setAlignment(Align(4)); + + // DWARF sections for XCOFF are not csects. They are special STYP_DWARF + // sections, and the individual DWARF sections are distinguished by their + // section subtype. + // TODO: Populate the DWARF sections appropriately. + DwarfAbbrevSection = nullptr; // SSUBTYP_DWABREV + DwarfInfoSection = nullptr; // SSUBTYP_DWINFO + DwarfLineSection = nullptr; // SSUBTYP_DWLINE + DwarfFrameSection = nullptr; // SSUBTYP_DWFRAME + DwarfPubNamesSection = nullptr; // SSUBTYP_DWPBNMS + DwarfPubTypesSection = nullptr; // SSUBTYP_DWPBTYP + DwarfStrSection = nullptr; // SSUBTYP_DWSTR + DwarfLocSection = nullptr; // SSUBTYP_DWLOC + DwarfARangesSection = nullptr; // SSUBTYP_DWARNGE + DwarfRangesSection = nullptr; // SSUBTYP_DWRNGES + DwarfMacinfoSection = nullptr; // SSUBTYP_DWMAC } void MCObjectFileInfo::InitMCObjectFileInfo(const Triple &TheTriple, bool PIC,