Clear pool relocs in volatile registers on function call

This fixes some false positives.
This commit is contained in:
LagoLunatic 2024-12-02 18:05:32 -05:00
parent 9051f48731
commit 507b988aa3
1 changed files with 10 additions and 0 deletions

View File

@ -520,6 +520,16 @@ fn generate_fake_pool_reloc_for_addr_mapping(
) => {
active_pool_relocs.insert(addr_dst_gpr.0, reloc.clone()); // `lis` + `ori`
}
(Opcode::B, _, _, _) => {
if simplified.mnemonic == "bl" {
// When encountering a function call, clear any active pool relocations from
// the volatile registers (r0, r3-r12), but not the nonvolatile registers.
active_pool_relocs.remove(&0);
for gpr in 3..12 {
active_pool_relocs.remove(&gpr);
}
}
}
_ => {}
}
} else if let Some((offset, addr_src_gpr, addr_dst_gpr)) =