mirror of
https://github.com/encounter/objdiff.git
synced 2025-12-12 14:46:12 +00:00
[MIPS] Fix symbols being filtered out from target side of diff if target object contains .NON_MATCHING markers (#250)
* Fix filtering out symbols from the target side that have a symbol with the same name and a `.NON_MATCHING` suffix. - Target side: Show all the symbols except the `.NON_MATCHING` ones. - Base side: Ignore all the `.NON_MATCHING` symbols and also ignore the ones with the same name without the suffix * fmt * comment * tests * fmt tests * maybe this could fix wasm? * Fix wasm? * fmt * Move `DiffSide` to `diff` mod * Update the stuff the advisories CI told me to
This commit is contained in:
@@ -24,7 +24,7 @@ wit_bindgen::generate!({
|
||||
|
||||
use exports::objdiff::core::{
|
||||
diff::{
|
||||
DiffConfigBorrow, DiffResult, Guest as GuestDiff, GuestDiffConfig, GuestObject,
|
||||
DiffConfigBorrow, DiffResult, DiffSide, Guest as GuestDiff, GuestDiffConfig, GuestObject,
|
||||
GuestObjectDiff, MappingConfig, Object, ObjectBorrow, ObjectDiff, ObjectDiffBorrow,
|
||||
SymbolFlags, SymbolInfo, SymbolKind, SymbolRef,
|
||||
},
|
||||
@@ -470,8 +470,21 @@ unsafe impl Sync for ObjectCache {}
|
||||
|
||||
static OBJECT_CACHE: ObjectCache = ObjectCache::new();
|
||||
|
||||
impl From<DiffSide> for objdiff_core::diff::DiffSide {
|
||||
fn from(value: DiffSide) -> Self {
|
||||
match value {
|
||||
DiffSide::Target => Self::Target,
|
||||
DiffSide::Base => Self::Base,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl GuestObject for ResourceObject {
|
||||
fn parse(data: Vec<u8>, diff_config: DiffConfigBorrow) -> Result<Object, String> {
|
||||
fn parse(
|
||||
data: Vec<u8>,
|
||||
diff_config: DiffConfigBorrow,
|
||||
diff_side: DiffSide,
|
||||
) -> Result<Object, String> {
|
||||
let hash = xxh3_64(&data);
|
||||
let mut cached = None;
|
||||
OBJECT_CACHE.borrow_mut().retain(|c| {
|
||||
@@ -487,7 +500,9 @@ impl GuestObject for ResourceObject {
|
||||
return Ok(Object::new(ResourceObject(obj, hash)));
|
||||
}
|
||||
let diff_config = diff_config.get::<ResourceDiffConfig>().0.borrow();
|
||||
let obj = Rc::new(obj::read::parse(&data, &diff_config).map_err(|e| e.to_string())?);
|
||||
let obj = Rc::new(
|
||||
obj::read::parse(&data, &diff_config, diff_side.into()).map_err(|e| e.to_string())?,
|
||||
);
|
||||
OBJECT_CACHE.borrow_mut().push(CachedObject(Rc::downgrade(&obj), hash));
|
||||
Ok(Object::new(ResourceObject(obj, hash)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user