Skip to content

Commit

Permalink
Merge pull request #1479 from coc-cyqh/master
Browse files Browse the repository at this point in the history
add reloc type R_ARM_ABS32,R_ARM_CALL,R_ARM_JUMP24
  • Loading branch information
xwings authored Jul 3, 2024
2 parents 6d2818b + 76bb092 commit 04e42e0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions qiling/loader/elf.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,15 @@ def __get_symbol(name: str) -> Optional[Symbol]:
ql.mem.write_ptr(prev_mips_hi16_loc + 2, (val >> 16), 2)
ql.mem.write_ptr(loc + 2, (val & 0xFFFF), 2)

elif desc in ('R_ARM_CALL', 'R_ARM_JUMP24'):
val = (rev_reloc_symbols[symbol_name] - loc - 8) >> 2
val = (val & 0xFFFFFF) | (ql.mem.read_ptr(loc, 4) & 0xFF000000)
ql.mem.write_ptr(loc, (val & 0xFFFFFFFF), 4)

elif desc == 'R_ARM_ABS32':
val = rev_reloc_symbols[symbol_name] + ql.mem.read_ptr(loc, 4)
ql.mem.write_ptr(loc, (val & 0xFFFFFFFF), 4)

else:
raise NotImplementedError(f'Relocation type {desc} not implemented')

Expand Down

0 comments on commit 04e42e0

Please sign in to comment.