From 1df4831d84b12397cb2584e582458982f4866216 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Sat, 8 Aug 2026 20:26:42 -0400 Subject: [PATCH 1/2] Xbox 360 PPC: Ignore unwinds and catches when inferring function sizes --- objdiff-core/src/obj/read.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/objdiff-core/src/obj/read.rs b/objdiff-core/src/obj/read.rs index 3377709c..4ec0e2a7 100644 --- a/objdiff-core/src/obj/read.rs +++ b/objdiff-core/src/obj/read.rs @@ -335,6 +335,8 @@ fn infer_symbol_sizes(arch: &dyn Arch, symbols: &mut [Symbol], sections: &[Secti SymbolKind::Function | SymbolKind::Object => { // For function/object symbols, find the next function/object matches!(next_symbol.kind, SymbolKind::Function | SymbolKind::Object) + && !next_symbol.name.starts_with("__unwind$") + && !next_symbol.name.starts_with("__catch$") } SymbolKind::Unknown | SymbolKind::Section => { // For labels (or anything else), stop at any symbol From e9af4f22644d2b83fcb83d652325e9760af0c4a0 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Sat, 8 Aug 2026 20:37:49 -0400 Subject: [PATCH 2/2] Don't check unwinds/catches when inferring object sizes, only functions --- objdiff-core/src/obj/read.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/objdiff-core/src/obj/read.rs b/objdiff-core/src/obj/read.rs index 4ec0e2a7..1bff9327 100644 --- a/objdiff-core/src/obj/read.rs +++ b/objdiff-core/src/obj/read.rs @@ -332,11 +332,17 @@ fn infer_symbol_sizes(arch: &dyn Arch, symbols: &mut [Symbol], sections: &[Secti break None; } if match symbol.kind { + SymbolKind::Function + if next_symbol.kind == SymbolKind::Function + && (next_symbol.name.starts_with("__unwind$") + || next_symbol.name.starts_with("__catch$")) => + { + // MSVC unwinds/catches count as functions, but shouldn't cut off the function they're from. + false + } SymbolKind::Function | SymbolKind::Object => { // For function/object symbols, find the next function/object matches!(next_symbol.kind, SymbolKind::Function | SymbolKind::Object) - && !next_symbol.name.starts_with("__unwind$") - && !next_symbol.name.starts_with("__catch$") } SymbolKind::Unknown | SymbolKind::Section => { // For labels (or anything else), stop at any symbol