Skip to content

Commit 507b988

Browse files
committed
Clear pool relocs in volatile registers on function call
This fixes some false positives.
1 parent 9051f48 commit 507b988

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

objdiff-core/src/arch/ppc.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,16 @@ fn generate_fake_pool_reloc_for_addr_mapping(
520520
) => {
521521
active_pool_relocs.insert(addr_dst_gpr.0, reloc.clone()); // `lis` + `ori`
522522
}
523+
(Opcode::B, _, _, _) => {
524+
if simplified.mnemonic == "bl" {
525+
// When encountering a function call, clear any active pool relocations from
526+
// the volatile registers (r0, r3-r12), but not the nonvolatile registers.
527+
active_pool_relocs.remove(&0);
528+
for gpr in 3..12 {
529+
active_pool_relocs.remove(&gpr);
530+
}
531+
}
532+
}
523533
_ => {}
524534
}
525535
} else if let Some((offset, addr_src_gpr, addr_dst_gpr)) =

0 commit comments

Comments
 (0)