Skip to content

Create new CAS Blocks to represent missing DWARF sections #8576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions llvm/include/llvm/MCCAS/MCCASObjectV1.def
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,19 @@ CASV1_SIMPLE_DATA_REF(DataInCodeRef, mc:data_in_code)
CASV1_SIMPLE_DATA_REF(CStringRef, mc:cstring)
CASV1_SIMPLE_DATA_REF(MergedFragmentRef, mc:merged_fragment)
CASV1_SIMPLE_DATA_REF(DebugStrRef, mc:debug_string)
CASV1_SIMPLE_DATA_REF(DebugStrOffsetsRef, mc:debug_string_offsets)
CASV1_SIMPLE_DATA_REF(DebugLocRef, mc:debug_loc)
CASV1_SIMPLE_DATA_REF(DebugLoclistsRef, mc:debug_loclists)
CASV1_SIMPLE_DATA_REF(DebugRangesRef, mc:debug_ranges)
CASV1_SIMPLE_DATA_REF(DebugRangelistsRef, mc:debug_rangelists)
CASV1_SIMPLE_DATA_REF(DebugNamesRef, mc:debug_names)
CASV1_SIMPLE_DATA_REF(AppleNamesRef, mc:apple_names)
CASV1_SIMPLE_DATA_REF(AppleTypesRef, mc:apple_types)
CASV1_SIMPLE_DATA_REF(AppleNamespaceRef, mc:apple_namespac)
CASV1_SIMPLE_DATA_REF(AppleObjCRef, mc:apple_objc)
CASV1_SIMPLE_DATA_REF(DebugLineRef, mc:debug_line)
CASV1_SIMPLE_DATA_REF(DebugLineUnoptRef, mc:debug_line_unopt)
CASV1_SIMPLE_DATA_REF(DebugLineStrRef, mc:debug_line_str)
CASV1_SIMPLE_DATA_REF(DebugInfoUnoptRef, mc:debug_info_unopt)
CASV1_SIMPLE_DATA_REF(DebugAbbrevUnoptRef, mc:debug_abbrev_unopt)
CASV1_SIMPLE_DATA_REF(DistinctDebugLineRef, mc:debug_line_distinct_data)
Expand All @@ -37,9 +48,20 @@ CASV1_SIMPLE_GROUP_REF(GroupRef, mc:group)
CASV1_SIMPLE_GROUP_REF(SectionRef, mc:section)
CASV1_SIMPLE_GROUP_REF(DebugAbbrevSectionRef, mc:debug_abbrev_section)
CASV1_SIMPLE_GROUP_REF(DebugLineSectionRef, mc:debug_line_section)
CASV1_SIMPLE_GROUP_REF(DebugLineStrSectionRef, mc:debug_line_str_section)
CASV1_SIMPLE_GROUP_REF(AtomRef, mc:atom)
CASV1_SIMPLE_GROUP_REF(SymbolTableRef, mc:symbol_table)
CASV1_SIMPLE_GROUP_REF(DebugStringSectionRef, mc:debug_string_section)
CASV1_SIMPLE_GROUP_REF(DebugStringOffsetsSectionRef, mc:debug_string_offsets_section)
CASV1_SIMPLE_GROUP_REF(DebugLocSectionRef, mc:debug_loc_section)
CASV1_SIMPLE_GROUP_REF(DebugLoclistsSectionRef, mc:debug_loclists_section)
CASV1_SIMPLE_GROUP_REF(DebugRangesSectionRef, mc:debug_ranges_section)
CASV1_SIMPLE_GROUP_REF(DebugRangelistsSectionRef, mc:debug_rangelists_section)
CASV1_SIMPLE_GROUP_REF(DebugNamesSectionRef, mc:debug_names_section)
CASV1_SIMPLE_GROUP_REF(AppleNamesSectionRef, mc:apple_names_section)
CASV1_SIMPLE_GROUP_REF(AppleTypesSectionRef, mc:apple_types_section)
CASV1_SIMPLE_GROUP_REF(AppleNamespaceSectionRef, mc:apple_namepsac_section)
CASV1_SIMPLE_GROUP_REF(AppleObjCSectionRef, mc:apple_objc_section)
CASV1_SIMPLE_GROUP_REF(DIEAbbrevSetRef, mc:debug_DIE_abbrev_set)
CASV1_SIMPLE_GROUP_REF(DIETopLevelRef, mc:debug_DIE_top_level)
CASV1_SIMPLE_GROUP_REF(DIEDedupeTopLevelRef, mc:debug_DIE_Dedupe_top_level)
Expand Down
57 changes: 57 additions & 0 deletions llvm/include/llvm/MCCAS/MCCASObjectV1.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,16 @@ struct DwarfSectionsCache {
MCSection *Str;
MCSection *Abbrev;
MCSection *StrOffsets;
MCSection *Loc;
MCSection *Loclists;
MCSection *Ranges;
MCSection *Rangelists;
MCSection *LineStr;
MCSection *Names;
MCSection *AppleNames;
MCSection *AppleTypes;
MCSection *AppleNamespace;
MCSection *AppleObjC;
};

/// Queries `Asm` for all dwarf sections and returns an object with (possibly
Expand Down Expand Up @@ -578,6 +588,9 @@ class MCCASBuilder {

Expected<SmallVector<DebugStrRef, 0>> createDebugStringRefs();

template <typename SectionTy>
std::optional<Expected<SectionTy>> createGenericDebugRef(MCSection *Section);

struct CUSplit {
SmallVector<MutableArrayRef<char>> SplitCUData;
SmallVector<size_t> AbbrevOffsets;
Expand All @@ -596,6 +609,50 @@ class MCCASBuilder {
// string in the section.
Error createDebugStrSection();

// If a DWARF String Offsets section exists, create a DebugStrOffsetsRef CAS
// object for the section.
Error createDebugStrOffsetsSection();

// If a DWARF Loc section exists, create a DebugLocRef CAS object for the
// section.
Error createDebugLocSection();

// If a DWARF Loclists section exists, create a DebugLoclistsRef CAS
// object for the section.
Error createDebugLoclistsSection();

// If a DWARF Ranges section exists, create a DebugRangesRef CAS
// object for the section.
Error createDebugRangesSection();

// If a DWARF Rangeslists section exists, create a DebugRangeslistsRef CAS
// object for the section.
Error createDebugRangelistsSection();

// If a DWARF LineStr section exists, create a DebugLineStrRef CAS
// object for the section.
Error createDebugLineStrSection();

// If a DWARF Names section exists, create a DebugNamesRef CAS
// object for the section.
Error createDebugNamesSection();

// If a DWARF Apple Names section exists, create a AppleNamesRef CAS
// object for the section.
Error createAppleNamesSection();

// If a DWARF Apple Types section exists, create a AppleTypesRef CAS
// object for the section.
Error createAppleTypesSection();

// If a DWARF Apple Namespaces section exists, create a AppleNamespaceRef CAS
// object for the section.
Error createAppleNamespaceSection();

// If a DWARF Apple Objc section exists, create a AppleObjcRef CAS
// object for the section.
Error createAppleObjCSection();

/// If there is any padding between one section and the next, create a
/// PaddingRef CAS object to represent the bytes of Padding between the two
/// sections.
Expand Down
Loading