Skip to content

Commit

Permalink
Add XCOFF section names (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzEq committed Jan 6, 2023
1 parent 059c553 commit 2a0afda
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,24 @@ impl SectionId {
_ => return None,
})
}

/// Returns the XCOFF section name for this kind.
pub fn xcoff_name(self) -> Option<&'static str> {
Some(match self {
SectionId::DebugAbbrev => ".dwabrev",
SectionId::DebugAranges => ".dwarnge",
SectionId::DebugFrame => ".dwframe",
SectionId::DebugInfo => ".dwinfo",
SectionId::DebugLine => ".dwline",
SectionId::DebugLoc => ".dwloc",
SectionId::DebugMacinfo => ".dwmac",
SectionId::DebugPubNames => ".dwpbnms",
SectionId::DebugPubTypes => ".dwpbtyp",
SectionId::DebugRanges => ".dwrnges",
SectionId::DebugStr => ".dwstr",
_ => return None,
})
}
}

/// An optionally-provided implementation-defined compilation unit ID to enable
Expand Down
6 changes: 6 additions & 0 deletions src/read/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,12 @@ pub trait Section<R>: From<R> {
Self::id().dwo_name()
}

/// Returns the XCOFF section name (if any) for this type when used in a XCOFF
/// file.
fn xcoff_section_name() -> Option<&'static str> {
Self::id().xcoff_name()
}

/// Try to load the section using the given loader function.
fn load<F, E>(f: F) -> core::result::Result<Self, E>
where
Expand Down

0 comments on commit 2a0afda

Please sign in to comment.