summaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCObjectFileInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC/MCObjectFileInfo.cpp')
-rw-r--r--llvm/lib/MC/MCObjectFileInfo.cpp70
1 files changed, 64 insertions, 6 deletions
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index d567cc14a8306..b77a9635f64c4 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -276,6 +276,9 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(const Triple &T) {
DwarfMacinfoSection =
Ctx->getMachOSection("__DWARF", "__debug_macinfo", MachO::S_ATTR_DEBUG,
SectionKind::getMetadata(), "debug_macinfo");
+ DwarfMacroSection =
+ Ctx->getMachOSection("__DWARF", "__debug_macro", MachO::S_ATTR_DEBUG,
+ SectionKind::getMetadata(), "debug_macro");
DwarfDebugInlineSection =
Ctx->getMachOSection("__DWARF", "__debug_inlined", MachO::S_ATTR_DEBUG,
SectionKind::getMetadata());
@@ -427,6 +430,7 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(const Triple &T, bool Large) {
Ctx->getELFSection(".debug_ranges", DebugSecType, 0);
DwarfMacinfoSection =
Ctx->getELFSection(".debug_macinfo", DebugSecType, 0);
+ DwarfMacroSection = Ctx->getELFSection(".debug_macro", DebugSecType, 0);
// DWARF5 Experimental Debug Info
@@ -469,6 +473,8 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(const Triple &T, bool Large) {
Ctx->getELFSection(".debug_rnglists.dwo", DebugSecType, ELF::SHF_EXCLUDE);
DwarfMacinfoDWOSection =
Ctx->getELFSection(".debug_macinfo.dwo", DebugSecType, ELF::SHF_EXCLUDE);
+ DwarfMacroDWOSection =
+ Ctx->getELFSection(".debug_macro.dwo", DebugSecType, ELF::SHF_EXCLUDE);
DwarfLoclistsDWOSection =
Ctx->getELFSection(".debug_loclists.dwo", DebugSecType, ELF::SHF_EXCLUDE);
@@ -610,6 +616,11 @@ void MCObjectFileInfo::initCOFFMCObjectFileInfo(const Triple &T) {
COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
COFF::IMAGE_SCN_MEM_READ,
SectionKind::getMetadata(), "section_debug_loc");
+ DwarfLoclistsSection = Ctx->getCOFFSection(
+ ".debug_loclists",
+ COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
+ COFF::IMAGE_SCN_MEM_READ,
+ SectionKind::getMetadata(), "section_debug_loclists");
DwarfARangesSection = Ctx->getCOFFSection(
".debug_aranges",
COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
@@ -620,16 +631,31 @@ void MCObjectFileInfo::initCOFFMCObjectFileInfo(const Triple &T) {
COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
COFF::IMAGE_SCN_MEM_READ,
SectionKind::getMetadata(), "debug_range");
+ DwarfRnglistsSection = Ctx->getCOFFSection(
+ ".debug_rnglists",
+ COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
+ COFF::IMAGE_SCN_MEM_READ,
+ SectionKind::getMetadata(), "debug_rnglists");
DwarfMacinfoSection = Ctx->getCOFFSection(
".debug_macinfo",
COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
COFF::IMAGE_SCN_MEM_READ,
SectionKind::getMetadata(), "debug_macinfo");
+ DwarfMacroSection = Ctx->getCOFFSection(
+ ".debug_macro",
+ COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
+ COFF::IMAGE_SCN_MEM_READ,
+ SectionKind::getMetadata(), "debug_macro");
DwarfMacinfoDWOSection = Ctx->getCOFFSection(
".debug_macinfo.dwo",
COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
COFF::IMAGE_SCN_MEM_READ,
SectionKind::getMetadata(), "debug_macinfo.dwo");
+ DwarfMacroDWOSection = Ctx->getCOFFSection(
+ ".debug_macro.dwo",
+ COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
+ COFF::IMAGE_SCN_MEM_READ,
+ SectionKind::getMetadata(), "debug_macro.dwo");
DwarfInfoDWOSection = Ctx->getCOFFSection(
".debug_info.dwo",
COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
@@ -761,7 +787,8 @@ void MCObjectFileInfo::initWasmMCObjectFileInfo(const Triple &T) {
Ctx->getWasmSection(".debug_ranges", SectionKind::getMetadata());
DwarfMacinfoSection =
Ctx->getWasmSection(".debug_macinfo", SectionKind::getMetadata());
- DwarfAddrSection = Ctx->getWasmSection(".debug_addr", SectionKind::getMetadata());
+ DwarfMacroSection =
+ Ctx->getWasmSection(".debug_macro", SectionKind::getMetadata());
DwarfCUIndexSection = Ctx->getWasmSection(".debug_cu_index", SectionKind::getMetadata());
DwarfTUIndexSection = Ctx->getWasmSection(".debug_tu_index", SectionKind::getMetadata());
DwarfInfoSection =
@@ -770,6 +797,17 @@ void MCObjectFileInfo::initWasmMCObjectFileInfo(const Triple &T) {
DwarfPubNamesSection = Ctx->getWasmSection(".debug_pubnames", SectionKind::getMetadata());
DwarfPubTypesSection = Ctx->getWasmSection(".debug_pubtypes", SectionKind::getMetadata());
+ DwarfDebugNamesSection =
+ Ctx->getWasmSection(".debug_names", SectionKind::getMetadata());
+ DwarfStrOffSection =
+ Ctx->getWasmSection(".debug_str_offsets", SectionKind::getMetadata());
+ DwarfAddrSection =
+ Ctx->getWasmSection(".debug_addr", SectionKind::getMetadata());
+ DwarfRnglistsSection =
+ Ctx->getWasmSection(".debug_rnglists", SectionKind::getMetadata());
+ DwarfLoclistsSection =
+ Ctx->getWasmSection(".debug_loclists", SectionKind::getMetadata());
+
// Wasm use data section for LSDA.
// TODO Consider putting each function's exception table in a separate
// section, as in -function-sections, to facilitate lld's --gc-section.
@@ -795,6 +833,29 @@ void MCObjectFileInfo::initXCOFFMCObjectFileInfo(const Triple &T) {
ReadOnlySection = Ctx->getXCOFFSection(
".rodata", XCOFF::StorageMappingClass::XMC_RO, XCOFF::XTY_SD,
XCOFF::C_HIDEXT, SectionKind::getReadOnly());
+
+ TOCBaseSection = Ctx->getXCOFFSection(
+ "TOC", XCOFF::StorageMappingClass::XMC_TC0, XCOFF::XTY_SD,
+ XCOFF::C_HIDEXT, SectionKind::getData());
+
+ // 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,
@@ -884,10 +945,7 @@ MCObjectFileInfo::getStackSizesSection(const MCSection &TextSec) const {
Flags |= ELF::SHF_GROUP;
}
- const MCSymbol *Link = TextSec.getBeginSymbol();
- auto It = StackSizesUniquing.insert({Link, StackSizesUniquing.size()});
- unsigned UniqueID = It.first->second;
-
return Ctx->getELFSection(".stack_sizes", ELF::SHT_PROGBITS, Flags, 0,
- GroupName, UniqueID, cast<MCSymbolELF>(Link));
+ GroupName, MCSection::NonUniqueID,
+ cast<MCSymbolELF>(TextSec.getBeginSymbol()));
}