Only create relocations for direct branches

This commit is contained in:
Luke Street 2023-08-09 23:59:26 -04:00
parent 457ee10a42
commit cf328b8707
1 changed files with 5 additions and 2 deletions

View File

@ -266,7 +266,9 @@ impl Tracker {
if is_function_addr(addr) { if is_function_addr(addr) {
Ok(ExecCbResult::Jump(addr)) Ok(ExecCbResult::Jump(addr))
} else { } else {
self.relocations.insert(ins.addr, Relocation::Rel24(addr)); if ins.is_direct_branch() {
self.relocations.insert(ins.addr, Relocation::Rel24(addr));
}
Ok(ExecCbResult::EndBlock) Ok(ExecCbResult::EndBlock)
} }
} }
@ -295,7 +297,8 @@ impl Tracker {
if branch.link || !is_function_addr(addr) { if branch.link || !is_function_addr(addr) {
self.relocations.insert(ins.addr, match ins.op { self.relocations.insert(ins.addr, match ins.op {
Opcode::B => Relocation::Rel24(addr), Opcode::B => Relocation::Rel24(addr),
_ => Relocation::Rel14(addr), Opcode::Bc => Relocation::Rel14(addr),
_ => continue,
}); });
} else if is_function_addr(addr) { } else if is_function_addr(addr) {
executor.push(addr, branch.vm, true); executor.push(addr, branch.vm, true);