Skip to content

Commit ab59aa6

Browse files
[XCOFF] XCOFF constants, MCObjectFileInfo placeholder code for DWARF; NFC
Summary: This patch introduces the constants defined to identify DWARF sections in XCOFF into `llvm/BinaryFormat/XCOFF.h` and adds (NFC) placeholder code to `llvm/lib/MC/MCObjectFileInfo.cpp` where the DWARF sections for XCOFF are to be set up. Reviewers: jasonliu, sfertile, daltenty, DiggerLin, Xiangling_L Reviewed By: jasonliu, sfertile, DiggerLin Differential Revision: https://reviews.llvm.org/D79220
1 parent b116ded commit ab59aa6

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

llvm/include/llvm/BinaryFormat/XCOFF.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,24 @@ enum SectionTypeFlags : int32_t {
7979
STYP_OVRFLO = 0x8000
8080
};
8181

82+
/// Values for defining the section subtype of sections of type STYP_DWARF as
83+
/// they would appear in the (signed, 32-bit) s_flags field of the section
84+
/// header structure, contributing to the 16 most significant bits. Defined in
85+
/// the system header `scnhdr.h`.
86+
enum DwarfSectionSubtypeFlags : int32_t {
87+
SSUBTYP_DWINFO = 0x1'0000, ///< DWARF info section
88+
SSUBTYP_DWLINE = 0x2'0000, ///< DWARF line section
89+
SSUBTYP_DWPBNMS = 0x3'0000, ///< DWARF pubnames section
90+
SSUBTYP_DWPBTYP = 0x4'0000, ///< DWARF pubtypes section
91+
SSUBTYP_DWARNGE = 0x5'0000, ///< DWARF aranges section
92+
SSUBTYP_DWABREV = 0x6'0000, ///< DWARF abbrev section
93+
SSUBTYP_DWSTR = 0x7'0000, ///< DWARF str section
94+
SSUBTYP_DWRNGES = 0x8'0000, ///< DWARF ranges section
95+
SSUBTYP_DWLOC = 0x9'0000, ///< DWARF loc section
96+
SSUBTYP_DWFRAME = 0xA'0000, ///< DWARF frame section
97+
SSUBTYP_DWMAC = 0xB'0000 ///< DWARF macinfo section
98+
};
99+
82100
// STORAGE CLASSES, n_sclass field of syment.
83101
// The values come from `storclass.h` and `dbxstclass.h`.
84102
enum StorageClass : uint8_t {

llvm/lib/MC/MCObjectFileInfo.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,22 @@ void MCObjectFileInfo::initXCOFFMCObjectFileInfo(const Triple &T) {
833833

834834
// The TOC-base always has 0 size, but 4 byte alignment.
835835
TOCBaseSection->setAlignment(Align(4));
836+
837+
// DWARF sections for XCOFF are not csects. They are special STYP_DWARF
838+
// sections, and the individual DWARF sections are distinguished by their
839+
// section subtype.
840+
// TODO: Populate the DWARF sections appropriately.
841+
DwarfAbbrevSection = nullptr; // SSUBTYP_DWABREV
842+
DwarfInfoSection = nullptr; // SSUBTYP_DWINFO
843+
DwarfLineSection = nullptr; // SSUBTYP_DWLINE
844+
DwarfFrameSection = nullptr; // SSUBTYP_DWFRAME
845+
DwarfPubNamesSection = nullptr; // SSUBTYP_DWPBNMS
846+
DwarfPubTypesSection = nullptr; // SSUBTYP_DWPBTYP
847+
DwarfStrSection = nullptr; // SSUBTYP_DWSTR
848+
DwarfLocSection = nullptr; // SSUBTYP_DWLOC
849+
DwarfARangesSection = nullptr; // SSUBTYP_DWARNGE
850+
DwarfRangesSection = nullptr; // SSUBTYP_DWRNGES
851+
DwarfMacinfoSection = nullptr; // SSUBTYP_DWMAC
836852
}
837853

838854
void MCObjectFileInfo::InitMCObjectFileInfo(const Triple &TheTriple, bool PIC,

0 commit comments

Comments
 (0)