Skip to content

Commit 2c57e49

Browse files
committed
Add ARM logic for inferred function size padding
Resolves encounter#237
1 parent cff4be2 commit 2c57e49

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

objdiff-core/src/arch/arm.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,22 @@ impl Arch for ArchArm {
464464
}
465465
flags
466466
}
467+
468+
fn infer_function_size(
469+
&self,
470+
symbol: &Symbol,
471+
section: &Section,
472+
mut next_address: u64,
473+
) -> Result<u64> {
474+
// Trim any trailing 4-byte zeroes from the end (padding)
475+
while next_address >= symbol.address + 4
476+
&& let Some(data) = section.data_range(next_address - 4, 4)
477+
&& data == [0u8; 4]
478+
{
479+
next_address -= 4;
480+
}
481+
Ok(next_address.saturating_sub(symbol.address))
482+
}
467483
}
468484

469485
#[derive(Clone, Copy, Debug)]

0 commit comments

Comments
 (0)