From 76bb0923afcb6004456e48b5154d5d161e804dbb Mon Sep 17 00:00:00 2001 From: Siqi Chen Date: Mon, 1 Jul 2024 10:21:31 +0800 Subject: [PATCH] add reloc type R_ARM_ABS32,R_ARM_CALL,R_ARM_JUMP24 --- qiling/loader/elf.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qiling/loader/elf.py b/qiling/loader/elf.py index c1d3eb970..3bd8de86d 100644 --- a/qiling/loader/elf.py +++ b/qiling/loader/elf.py @@ -555,6 +555,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')