Skip to content

Commit f58616b

Browse files
authored
Use symbol name when comparing against an externed reloc (#214)
* Use symbol name when comparing against an externed reloc For partial matching files, often a symbol is externed even though it should exist in the target object. We can still compare the symbol name, instead of always returning a mismatch. * Combine cases, and apply change reloc_eq in code.rs
1 parent e9762e2 commit f58616b

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

objdiff-core/src/diff/code.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,11 @@ fn reloc_eq(
325325
|| display_ins_data_literals(left_obj, left_ins)
326326
== display_ins_data_literals(right_obj, right_ins))
327327
}
328-
(Some(_), None) => false,
329328
(None, Some(_)) => {
330329
// Match if possibly stripped weak symbol
331330
symbol_name_addend_matches && right_reloc.symbol.flags.contains(SymbolFlag::Weak)
332331
}
333-
(None, None) => symbol_name_addend_matches,
332+
(Some(_), None) | (None, None) => symbol_name_addend_matches,
334333
}
335334
}
336335

objdiff-core/src/diff/data.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,11 @@ fn reloc_eq(
5353
section_name_eq(left_obj, right_obj, sl, sr)
5454
&& (symbol_name_addend_matches || address_eq(left, right))
5555
}
56-
(Some(_), None) => false,
5756
(None, Some(_)) => {
5857
// Match if possibly stripped weak symbol
5958
symbol_name_addend_matches && right.symbol.flags.contains(SymbolFlag::Weak)
6059
}
61-
(None, None) => symbol_name_addend_matches,
60+
(Some(_), None) | (None, None) => symbol_name_addend_matches,
6261
}
6362
}
6463

0 commit comments

Comments
 (0)