diff --git a/elftools/elf/relocation.py b/elftools/elf/relocation.py index 5aa55247..d9bb723b 100644 --- a/elftools/elf/relocation.py +++ b/elftools/elf/relocation.py @@ -340,27 +340,35 @@ def _do_apply_relocation(self, stream, reloc, symtab): _RELOCATION_RECIPE_TYPE = namedtuple('_RELOCATION_RECIPE_TYPE', 'bytesize has_addend calc_func') + @staticmethod def _reloc_calc_identity(value, sym_value, offset, addend=0): return value + @staticmethod def _reloc_calc_sym_plus_value(value, sym_value, offset, addend=0): return sym_value + value + addend + @staticmethod def _reloc_calc_sym_plus_value_pcrel(value, sym_value, offset, addend=0): return sym_value + value - offset + @staticmethod def _reloc_calc_sym_plus_addend(value, sym_value, offset, addend=0): return sym_value + addend + @staticmethod def _reloc_calc_sym_plus_addend_pcrel(value, sym_value, offset, addend=0): return sym_value + addend - offset + @staticmethod def _reloc_calc_value_minus_sym_addend(value, sym_value, offset, addend=0): return value - sym_value - addend + @staticmethod def _arm_reloc_calc_sym_plus_value_pcrel(value, sym_value, offset, addend=0): return sym_value // 4 + value - offset // 4 + @staticmethod def _bpf_64_32_reloc_calc_sym_plus_addend(value, sym_value, offset, addend=0): return (sym_value + addend) // 8 - 1