Symtab *ObjectFileWasm::GetSymtab() { return nullptr; }
+static SectionType GetSectionTypeFromName(llvm::StringRef Name) {
+ if (Name.consume_front(".debug_") || Name.consume_front(".zdebug_")) {
+ return llvm::StringSwitch<SectionType>(Name)
+ .Case("abbrev", eSectionTypeDWARFDebugAbbrev)
+ .Case("abbrev.dwo", eSectionTypeDWARFDebugAbbrevDwo)
+ .Case("addr", eSectionTypeDWARFDebugAddr)
+ .Case("aranges", eSectionTypeDWARFDebugAranges)
+ .Case("cu_index", eSectionTypeDWARFDebugCuIndex)
+ .Case("frame", eSectionTypeDWARFDebugFrame)
+ .Case("info", eSectionTypeDWARFDebugInfo)
+ .Case("info.dwo", eSectionTypeDWARFDebugInfoDwo)
+ .Cases("line", "line.dwo", eSectionTypeDWARFDebugLine)
+ .Cases("line_str", "line_str.dwo", eSectionTypeDWARFDebugLineStr)
+ .Case("loc", eSectionTypeDWARFDebugLoc)
+ .Case("loc.dwo", eSectionTypeDWARFDebugLocDwo)
+ .Case("loclists", eSectionTypeDWARFDebugLocLists)
+ .Case("loclists.dwo", eSectionTypeDWARFDebugLocListsDwo)
+ .Case("macinfo", eSectionTypeDWARFDebugMacInfo)
+ .Cases("macro", "macro.dwo", eSectionTypeDWARFDebugMacro)
+ .Case("names", eSectionTypeDWARFDebugNames)
+ .Case("pubnames", eSectionTypeDWARFDebugPubNames)
+ .Case("pubtypes", eSectionTypeDWARFDebugPubTypes)
+ .Case("ranges", eSectionTypeDWARFDebugRanges)
+ .Case("rnglists", eSectionTypeDWARFDebugRngLists)
+ .Case("rnglists.dwo", eSectionTypeDWARFDebugRngListsDwo)
+ .Case("str", eSectionTypeDWARFDebugStr)
+ .Case("str.dwo", eSectionTypeDWARFDebugStrDwo)
+ .Case("str_offsets", eSectionTypeDWARFDebugStrOffsets)
+ .Case("str_offsets.dwo", eSectionTypeDWARFDebugStrOffsetsDwo)
+ .Case("tu_index", eSectionTypeDWARFDebugTuIndex)
+ .Case("types", eSectionTypeDWARFDebugTypes)
+ .Case("types.dwo", eSectionTypeDWARFDebugTypesDwo)
+ .Default(eSectionTypeOther);
+ }
+ return eSectionTypeOther;
+}
+
void ObjectFileWasm::CreateSections(SectionList &unified_section_list) {
if (m_sections_up)
return;
// Code section.
vm_addr = 0;
} else {
- section_type =
- llvm::StringSwitch<SectionType>(sect_info.name.GetStringRef())
- .Case(".debug_abbrev", eSectionTypeDWARFDebugAbbrev)
- .Case(".debug_addr", eSectionTypeDWARFDebugAddr)
- .Case(".debug_aranges", eSectionTypeDWARFDebugAranges)
- .Case(".debug_cu_index", eSectionTypeDWARFDebugCuIndex)
- .Case(".debug_frame", eSectionTypeDWARFDebugFrame)
- .Case(".debug_info", eSectionTypeDWARFDebugInfo)
- .Case(".debug_line", eSectionTypeDWARFDebugLine)
- .Case(".debug_line_str", eSectionTypeDWARFDebugLineStr)
- .Case(".debug_loc", eSectionTypeDWARFDebugLoc)
- .Case(".debug_loclists", eSectionTypeDWARFDebugLocLists)
- .Case(".debug_macinfo", eSectionTypeDWARFDebugMacInfo)
- .Case(".debug_macro", eSectionTypeDWARFDebugMacro)
- .Case(".debug_names", eSectionTypeDWARFDebugNames)
- .Case(".debug_pubnames", eSectionTypeDWARFDebugPubNames)
- .Case(".debug_pubtypes", eSectionTypeDWARFDebugPubTypes)
- .Case(".debug_ranges", eSectionTypeDWARFDebugRanges)
- .Case(".debug_rnglists", eSectionTypeDWARFDebugRngLists)
- .Case(".debug_str", eSectionTypeDWARFDebugStr)
- .Case(".debug_str_offsets", eSectionTypeDWARFDebugStrOffsets)
- .Case(".debug_types", eSectionTypeDWARFDebugTypes)
- .Default(eSectionTypeOther);
+ section_type = GetSectionTypeFromName(sect_info.name.GetStringRef());
if (section_type == eSectionTypeOther)
continue;
section_name = sect_info.name;
# CHECK: VM size: 0
# CHECK: File size: 3
+# CHECK: Name: .debug_abbrev.dwo
+# CHECK: Type: dwarf-abbrev-dwo
+# CHECK: VM address: 0x0
+# CHECK: VM size: 0
+# CHECK: File size: 4
+
+# CHECK: Name: .debug_info.dwo
+# CHECK: Type: dwarf-info-dwo
+# CHECK: VM address: 0x0
+# CHECK: VM size: 0
+# CHECK: File size: 4
+
+# CHECK: Name: .debug_line.dwo
+# CHECK: Type: dwarf-line
+# CHECK: VM address: 0x0
+# CHECK: VM size: 0
+# CHECK: File size: 4
+
+# CHECK: Name: .debug_line_str.dwo
+# CHECK: Type: dwarf-line-str
+# CHECK: VM address: 0x0
+# CHECK: VM size: 0
+# CHECK: File size: 4
+
+# CHECK: Name: .debug_loc.dwo
+# CHECK: Type: dwarf-loc-dwo
+# CHECK: VM address: 0x0
+# CHECK: VM size: 0
+# CHECK: File size: 4
+
+# CHECK: Name: .debug_loclists.dwo
+# CHECK: Type: dwarf-loclists-dwo
+# CHECK: VM address: 0x0
+# CHECK: VM size: 0
+# CHECK: File size: 4
+
+# CHECK: Name: .debug_macro.dwo
+# CHECK: Type: dwarf-macro
+# CHECK: VM address: 0x0
+# CHECK: VM size: 0
+# CHECK: File size: 4
+
+# CHECK: Name: .debug_rnglists.dwo
+# CHECK: Type: dwarf-rnglists-dwo
+# CHECK: VM address: 0x0
+# CHECK: VM size: 0
+# CHECK: File size: 4
+
+# CHECK: Name: .debug_str.dwo
+# CHECK: Type: dwarf-str-dwo
+# CHECK: VM address: 0x0
+# CHECK: VM size: 0
+# CHECK: File size: 4
+
+# CHECK: Name: .debug_str_offsets.dwo
+# CHECK: Type: dwarf-str-offsets-dwo
+# CHECK: VM address: 0x0
+# CHECK: VM size: 0
+# CHECK: File size: 4
+
+# CHECK: Name: .debug_types.dwo
+# CHECK: Type: dwarf-types-dwo
+# CHECK: VM address: 0x0
+# CHECK: VM size: 0
+# CHECK: File size: 4
+
+
--- !WASM
FileHeader:
Version: 0x00000001
- Type: CUSTOM
Name: .debug_str
Payload: 636CFF
+ - Type: CUSTOM
+ Name: .debug_abbrev.dwo
+ Payload: DEADBEEF
+ - Type: CUSTOM
+ Name: .debug_info.dwo
+ Payload: DEADBEEF
+ - Type: CUSTOM
+ Name: .debug_line.dwo
+ Payload: DEADBEEF
+ - Type: CUSTOM
+ Name: .debug_line_str.dwo
+ Payload: DEADBEEF
+ - Type: CUSTOM
+ Name: .debug_loc.dwo
+ Payload: DEADBEEF
+ - Type: CUSTOM
+ Name: .debug_loclists.dwo
+ Payload: DEADBEEF
+ - Type: CUSTOM
+ Name: .debug_macro.dwo
+ Payload: DEADBEEF
+ - Type: CUSTOM
+ Name: .debug_rnglists.dwo
+ Payload: DEADBEEF
+ - Type: CUSTOM
+ Name: .debug_str.dwo
+ Payload: DEADBEEF
+ - Type: CUSTOM
+ Name: .debug_str_offsets.dwo
+ Payload: DEADBEEF
+ - Type: CUSTOM
+ Name: .debug_types.dwo
+ Payload: DEADBEEF
...