diff options
author | Raphael Gault <raphael.gault@arm.com> | 2020-03-27 15:28:45 +0000 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2020-04-22 10:53:49 +0200 |
commit | bfb08f220312a4634532114eb3e7062f17dfb707 (patch) | |
tree | 4453926dd61754ee451d2139cecd07b3e52d9abb /tools/objtool/arch/x86 | |
parent | aff5e16918c3706622b138ea82391d6c597c5660 (diff) |
objtool: Add abstraction for destination offsets
The jump and call destination relocation offsets are x86-specific.
Abstract them by calling arch-specific implementations.
[ jthierry: Remove superfluous comment; replace other addend offsets
with arch_dest_rela_offset() ]
Signed-off-by: Raphael Gault <raphael.gault@arm.com>
Signed-off-by: Julien Thierry <jthierry@redhat.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/objtool/arch/x86')
-rw-r--r-- | tools/objtool/arch/x86/decode.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c index a62e032863a8..7ce8650cf085 100644 --- a/tools/objtool/arch/x86/decode.c +++ b/tools/objtool/arch/x86/decode.c @@ -11,6 +11,7 @@ #include "../../../arch/x86/lib/inat.c" #include "../../../arch/x86/lib/insn.c" +#include "../../check.h" #include "../../elf.h" #include "../../arch.h" #include "../../warn.h" @@ -66,6 +67,16 @@ bool arch_callee_saved_reg(unsigned char reg) } } +unsigned long arch_dest_rela_offset(int addend) +{ + return addend + 4; +} + +unsigned long arch_jump_destination(struct instruction *insn) +{ + return insn->offset + insn->len + insn->immediate; +} + int arch_decode_instruction(struct elf *elf, struct section *sec, unsigned long offset, unsigned int maxlen, unsigned int *len, enum insn_type *type, |