From 79bd7317c181251785893389e2324ef950e68af6 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Thu, 31 Oct 2024 17:24:33 -0600 Subject: [PATCH] Match BranchDest->Reloc with relaxed relocation diffs --- objdiff-core/src/diff/code.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/objdiff-core/src/diff/code.rs b/objdiff-core/src/diff/code.rs index c840f85..86584e6 100644 --- a/objdiff-core/src/diff/code.rs +++ b/objdiff-core/src/diff/code.rs @@ -259,11 +259,17 @@ fn arg_eq( right_diff.ins.as_ref().and_then(|i| i.reloc.as_ref()), ) } - ObjInsArg::BranchDest(_) => { + ObjInsArg::BranchDest(_) => match right { // Compare dest instruction idx after diffing - left_diff.branch_to.as_ref().map(|b| b.ins_idx) - == right_diff.branch_to.as_ref().map(|b| b.ins_idx) - } + ObjInsArg::BranchDest(_) => { + left_diff.branch_to.as_ref().map(|b| b.ins_idx) + == right_diff.branch_to.as_ref().map(|b| b.ins_idx) + } + // If relocations are relaxed, match if left is a constant and right is a reloc + // Useful for instances where the target object is created without relocations + ObjInsArg::Reloc => config.relax_reloc_diffs, + _ => false, + }, } }