From 91bc23edfcdf58370e4a4350afe861d4c05bbf0b Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 2 Aug 2025 11:32:04 -0600 Subject: [PATCH] Fix objdiff-wasm build --- objdiff-core/src/obj/dwarf2.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/objdiff-core/src/obj/dwarf2.rs b/objdiff-core/src/obj/dwarf2.rs index 827d98c..b99fc26 100644 --- a/objdiff-core/src/obj/dwarf2.rs +++ b/objdiff-core/src/obj/dwarf2.rs @@ -1,5 +1,7 @@ +use alloc::{borrow::Cow, vec::Vec}; + use anyhow::{Context, Result}; -use object::{Object, ObjectSection}; +use object::{Object as _, ObjectSection as _}; use typed_arena::Arena; use crate::obj::{Section, SectionKind}; @@ -83,7 +85,7 @@ fn load_file_section<'input, 'arena, Endian: gimli::Endianity>( id: gimli::SectionId, file: &object::File<'input>, endian: Endian, - arena_data: &'arena Arena>, + arena_data: &'arena Arena>, arena_relocations: &'arena Arena, ) -> Result>> { let mut relocations = RelocationMap::default(); @@ -93,7 +95,7 @@ fn load_file_section<'input, 'arena, Endian: gimli::Endianity>( section.uncompressed_data()? } // Use a non-zero capacity so that `ReaderOffsetId`s are unique. - None => alloc::borrow::Cow::Owned(Vec::with_capacity(1)), + None => Cow::Owned(Vec::with_capacity(1)), }; let data_ref = arena_data.alloc(data); let section = gimli::EndianSlice::new(data_ref, endian); @@ -101,6 +103,7 @@ fn load_file_section<'input, 'arena, Endian: gimli::Endianity>( Ok(Relocate::new(section, relocations)) } +#[inline] fn gimli_error(e: gimli::Error, context: &str) -> anyhow::Error { anyhow::anyhow!("gimli error {context}: {e:?}") }