aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCObjectFileInfo.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2020-08-07 21:23:11 -0700
committerDerek Schuff <dschuff@chromium.org>2020-09-17 14:42:41 -0700
commit0ff28fa6a75617d61b1aeea77463d6a1684c3c89 (patch)
treefa2203080de5d2cef797767758e189db593f82a7 /llvm/lib/MC/MCObjectFileInfo.cpp
parenta0017c2bc258690146f18491317144e487ddb101 (diff)
downloadllvm-0ff28fa6a75617d61b1aeea77463d6a1684c3c89.zip
llvm-0ff28fa6a75617d61b1aeea77463d6a1684c3c89.tar.gz
llvm-0ff28fa6a75617d61b1aeea77463d6a1684c3c89.tar.bz2
Support dwarf fission for wasm object files
Initial support for dwarf fission sections (-gsplit-dwarf) on wasm. The most interesting change is support for writing 2 files (.o and .dwo) in the wasm object writer. My approach moves object-writing logic into its own function and calls it twice, swapping out the endian::Writer (W) in between calls. It also splits the import-preparation step into its own function (and skips it when writing a dwo). Differential Revision: https://reviews.llvm.org/D85685
Diffstat (limited to 'llvm/lib/MC/MCObjectFileInfo.cpp')
-rw-r--r--llvm/lib/MC/MCObjectFileInfo.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index 0660780..ae7345c 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -796,6 +796,10 @@ void MCObjectFileInfo::initWasmMCObjectFileInfo(const Triple &T) {
DwarfFrameSection = Ctx->getWasmSection(".debug_frame", SectionKind::getMetadata());
DwarfPubNamesSection = Ctx->getWasmSection(".debug_pubnames", SectionKind::getMetadata());
DwarfPubTypesSection = Ctx->getWasmSection(".debug_pubtypes", SectionKind::getMetadata());
+ DwarfGnuPubNamesSection =
+ Ctx->getWasmSection(".debug_gnu_pubnames", SectionKind::getMetadata());
+ DwarfGnuPubTypesSection =
+ Ctx->getWasmSection(".debug_gnu_pubtypes", SectionKind::getMetadata());
DwarfDebugNamesSection =
Ctx->getWasmSection(".debug_names", SectionKind::getMetadata());
@@ -808,6 +812,37 @@ void MCObjectFileInfo::initWasmMCObjectFileInfo(const Triple &T) {
DwarfLoclistsSection =
Ctx->getWasmSection(".debug_loclists", SectionKind::getMetadata());
+ // Fission Sections
+ DwarfInfoDWOSection =
+ Ctx->getWasmSection(".debug_info.dwo", SectionKind::getMetadata());
+ DwarfTypesDWOSection =
+ Ctx->getWasmSection(".debug_types.dwo", SectionKind::getMetadata());
+ DwarfAbbrevDWOSection =
+ Ctx->getWasmSection(".debug_abbrev.dwo", SectionKind::getMetadata());
+ DwarfStrDWOSection =
+ Ctx->getWasmSection(".debug_str.dwo", SectionKind::getMetadata());
+ DwarfLineDWOSection =
+ Ctx->getWasmSection(".debug_line.dwo", SectionKind::getMetadata());
+ DwarfLocDWOSection =
+ Ctx->getWasmSection(".debug_loc.dwo", SectionKind::getMetadata());
+ DwarfStrOffDWOSection =
+ Ctx->getWasmSection(".debug_str_offsets.dwo", SectionKind::getMetadata());
+ DwarfRnglistsDWOSection =
+ Ctx->getWasmSection(".debug_rnglists.dwo", SectionKind::getMetadata());
+ DwarfMacinfoDWOSection =
+ Ctx->getWasmSection(".debug_macinfo.dwo", SectionKind::getMetadata());
+ DwarfMacroDWOSection =
+ Ctx->getWasmSection(".debug_macro.dwo", SectionKind::getMetadata());
+
+ DwarfLoclistsDWOSection =
+ Ctx->getWasmSection(".debug_loclists.dwo", SectionKind::getMetadata());
+
+ // DWP Sections
+ DwarfCUIndexSection =
+ Ctx->getWasmSection(".debug_cu_index", SectionKind::getMetadata(), 0);
+ DwarfTUIndexSection =
+ Ctx->getWasmSection(".debug_tu_index", SectionKind::getMetadata(), 0);
+
// 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.