diff --git a/src/read/cfi.rs b/src/read/cfi.rs index 958b23950..7e7cef75e 100644 --- a/src/read/cfi.rs +++ b/src/read/cfi.rs @@ -525,9 +525,6 @@ pub trait _UnwindSectionPrivate { /// underflows, return `None`. fn resolve_cie_offset(&self, base: R::Offset, offset: R::Offset) -> Option; - /// Return true if our parser is compatible with the given version. - fn compatible_version(version: u8) -> bool; - /// Does this version of this unwind section encode address and segment /// sizes in its CIEs? fn has_address_and_segment_sizes(version: u8) -> bool; @@ -721,16 +718,6 @@ impl _UnwindSectionPrivate for DebugFrame { Some(offset) } - fn compatible_version(version: u8) -> bool { - // Version 1 of `.debug_frame` corresponds to DWARF 2, and then for - // DWARF 3 and 4, I think they decided to just match the standard's - // version. - match version { - 1 | 3 | 4 => true, - _ => false, - } - } - fn has_address_and_segment_sizes(version: u8) -> bool { version == 4 } @@ -771,16 +758,6 @@ impl _UnwindSectionPrivate for EhFrame { base.checked_sub(offset) } - fn compatible_version(version: u8) -> bool { - // While the `.eh_frame` header can only have version 1, CIEs can also occur in version 3. - // Like in `.debug_frame`, their return address is encoded as a single byte in version 1 and - // LEB128 otherwise. - match version { - 1 | 3 => true, - _ => false, - } - } - fn has_address_and_segment_sizes(_version: u8) -> bool { false } @@ -1262,8 +1239,13 @@ impl CommonInformationEntry { mut rest: R, ) -> Result> { let version = rest.read_u8()?; - if !Section::compatible_version(version) { - return Err(Error::UnknownVersion(u64::from(version))); + + // Version 1 of `.debug_frame` corresponds to DWARF 2, and then for + // DWARF 3 and 4, I think they decided to just match the standard's + // version. + match version { + 1 | 3 | 4 => (), + _ => return Err(Error::UnknownVersion(u64::from(version))), } let mut augmentation_string = rest.read_null_terminated_slice()?;