Skip to content

Commit cbe299e

Browse files
committed
Fix logic issue with 0-sized symbols
Fixes #119
1 parent 741d93e commit cbe299e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

objdiff-core/src/obj/read.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,14 @@ fn symbols_by_section(
182182
result.sort_by(|a, b| a.address.cmp(&b.address).then(a.size.cmp(&b.size)));
183183
let mut iter = result.iter_mut().peekable();
184184
while let Some(symbol) = iter.next() {
185-
if symbol.kind == ObjSymbolKind::Unknown && symbol.size == 0 {
185+
if symbol.size == 0 {
186186
if let Some(next_symbol) = iter.peek() {
187187
symbol.size = next_symbol.address - symbol.address;
188188
} else {
189189
symbol.size = (section.address + section.size) - symbol.address;
190190
}
191191
// Set symbol kind if we ended up with a non-zero size
192-
if symbol.size > 0 {
192+
if symbol.kind == ObjSymbolKind::Unknown && symbol.size > 0 {
193193
symbol.kind = match section.kind {
194194
ObjSectionKind::Code => ObjSymbolKind::Function,
195195
ObjSectionKind::Data | ObjSectionKind::Bss => ObjSymbolKind::Object,

0 commit comments

Comments
 (0)