Skip to content

Commit 5346d7b

Browse files
committed
Add "Relax shifted data diffs" option
1 parent 85e5fd9 commit 5346d7b

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

objdiff-core/src/diff/code.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,9 @@ fn reloc_eq(
236236
(Some(sl), Some(sr)) => {
237237
// Match if section and name or address match
238238
section_name_eq(left_obj, right_obj, *sl, *sr)
239-
&& (symbol_name_matches || address_eq(left, right))
239+
&& (symbol_name_matches
240+
|| address_eq(left, right)
241+
|| config.relax_shifted_data_diffs)
240242
&& (left.target.kind != ObjSymbolKind::Object
241243
|| right.target.name.starts_with("...")
242244
|| left.target.bytes == right.target.bytes)

objdiff-core/src/diff/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ const fn default_true() -> bool { true }
160160
#[serde(default)]
161161
pub struct DiffObjConfig {
162162
pub relax_reloc_diffs: bool,
163+
pub relax_shifted_data_diffs: bool,
163164
#[serde(default = "default_true")]
164165
pub space_between_args: bool,
165166
pub combine_data_sections: bool,
@@ -184,6 +185,7 @@ impl Default for DiffObjConfig {
184185
fn default() -> Self {
185186
Self {
186187
relax_reloc_diffs: false,
188+
relax_shifted_data_diffs: false,
187189
space_between_args: true,
188190
combine_data_sections: false,
189191
symbol_mappings: Default::default(),

objdiff-gui/src/app.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,18 @@ impl eframe::App for App {
740740
{
741741
state.queue_reload = true;
742742
}
743+
if ui
744+
.checkbox(
745+
&mut state.config.diff_obj_config.relax_shifted_data_diffs,
746+
"Relax shifted data diffs",
747+
)
748+
.on_hover_text(
749+
"Ignores differences in addresses for symbols with matching data.",
750+
)
751+
.changed()
752+
{
753+
state.queue_reload = true;
754+
}
743755
if ui
744756
.checkbox(
745757
&mut state.config.diff_obj_config.space_between_args,

0 commit comments

Comments
 (0)