Skip to content

Commit 79bd731

Browse files
committed
Match BranchDest->Reloc with relaxed relocation diffs
1 parent 21f8f24 commit 79bd731

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

objdiff-core/src/diff/code.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,17 @@ fn arg_eq(
259259
right_diff.ins.as_ref().and_then(|i| i.reloc.as_ref()),
260260
)
261261
}
262-
ObjInsArg::BranchDest(_) => {
262+
ObjInsArg::BranchDest(_) => match right {
263263
// Compare dest instruction idx after diffing
264-
left_diff.branch_to.as_ref().map(|b| b.ins_idx)
265-
== right_diff.branch_to.as_ref().map(|b| b.ins_idx)
266-
}
264+
ObjInsArg::BranchDest(_) => {
265+
left_diff.branch_to.as_ref().map(|b| b.ins_idx)
266+
== right_diff.branch_to.as_ref().map(|b| b.ins_idx)
267+
}
268+
// If relocations are relaxed, match if left is a constant and right is a reloc
269+
// Useful for instances where the target object is created without relocations
270+
ObjInsArg::Reloc => config.relax_reloc_diffs,
271+
_ => false,
272+
},
267273
}
268274
}
269275

0 commit comments

Comments
 (0)