aya: fix call relocation bug

Take the section offset into account when looking up relocation entries
pull/67/head
Alessandro Decina 3 years ago
parent dc4b928ec5
commit 59a1854a6b

@ -257,8 +257,9 @@ impl<'a> FunctionLinker<'a> {
continue;
}
let callee_address =
if let Some(rel) = rel_info(((ins_index - start_ins) * INS_SIZE) as u64) {
let callee_address = if let Some(rel) =
rel_info((fun.section_offset + (ins_index - start_ins) * INS_SIZE) as u64)
{
// We have a relocation entry for the instruction at `ins_index`, the address of
// the callee is the address of the relocation's target symbol.
rel_target_address(rel, self.symbol_table)?

Loading…
Cancel
Save