From 2c57e4960f505e3d061b0eb65364d6cbd7f6a175 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Fri, 15 Aug 2025 14:48:26 -0600 Subject: [PATCH] Add ARM logic for inferred function size padding Resolves #237 --- objdiff-core/src/arch/arm.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/objdiff-core/src/arch/arm.rs b/objdiff-core/src/arch/arm.rs index 8ce6901..b7714e1 100644 --- a/objdiff-core/src/arch/arm.rs +++ b/objdiff-core/src/arch/arm.rs @@ -464,6 +464,22 @@ impl Arch for ArchArm { } flags } + + fn infer_function_size( + &self, + symbol: &Symbol, + section: &Section, + mut next_address: u64, + ) -> Result { + // Trim any trailing 4-byte zeroes from the end (padding) + while next_address >= symbol.address + 4 + && let Some(data) = section.data_range(next_address - 4, 4) + && data == [0u8; 4] + { + next_address -= 4; + } + Ok(next_address.saturating_sub(symbol.address)) + } } #[derive(Clone, Copy, Debug)]