(
id: gimli::SectionId,
file: &object::File<'input>,
endian: Endian,
arena_data: &'arena Arena<Cow<'input, [u8]>>,
arena_relocations: &'arena Arena<RelocationMap>,
)
| 82 | type Relocate<'a, R> = gimli::RelocateReader<R, &'a RelocationMap>; |
| 83 | |
| 84 | fn load_file_section<'input, 'arena, Endian: gimli::Endianity>( |
| 85 | id: gimli::SectionId, |
| 86 | file: &object::File<'input>, |
| 87 | endian: Endian, |
| 88 | arena_data: &'arena Arena<Cow<'input, [u8]>>, |
| 89 | arena_relocations: &'arena Arena<RelocationMap>, |
| 90 | ) -> Result<Relocate<'arena, gimli::EndianSlice<'arena, Endian>>> { |
| 91 | let mut relocations = RelocationMap::default(); |
| 92 | let data = match file.section_by_name(id.name()) { |
| 93 | Some(ref section) => { |
| 94 | relocations.add(file, section); |
| 95 | section.uncompressed_data()? |
| 96 | } |
| 97 | // Use a non-zero capacity so that `ReaderOffsetId`s are unique. |
| 98 | None => Cow::Owned(Vec::with_capacity(1)), |
| 99 | }; |
| 100 | let data_ref = arena_data.alloc(data); |
| 101 | let section = gimli::EndianSlice::new(data_ref, endian); |
| 102 | let relocations = arena_relocations.alloc(relocations); |
| 103 | Ok(Relocate::new(section, relocations)) |
| 104 | } |
| 105 | |
| 106 | #[inline] |
| 107 | fn gimli_error(e: gimli::Error, context: &str) -> anyhow::Error { |
no test coverage detected