objtool: Use arch_jump_destination() in read_intra_function_calls()
authorChen Zhongjin <chenzhongjin@huawei.com>
Thu, 18 Aug 2022 01:45:53 +0000 (09:45 +0800)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 19 Aug 2022 17:47:56 +0000 (19:47 +0200)
Use arch_jump_destiation() instead of the open-coded 'offset + len +
immediate' that is x86 specific.

Avoids future trouble with other architectures.

Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220818014553.220261-1-chenzhongjin@huawei.com
tools/objtool/check.c

index 0cec74da7ffea42da25d5423207995e1a0579ad0..b012d987a6586c0c10a16f982d5850af129e9cc1 100644 (file)
@@ -2233,7 +2233,7 @@ static int read_intra_function_calls(struct objtool_file *file)
                 */
                insn->type = INSN_JUMP_UNCONDITIONAL;
 
-               dest_off = insn->offset + insn->len + insn->immediate;
+               dest_off = arch_jump_destination(insn);
                insn->jump_dest = find_insn(file, insn->sec, dest_off);
                if (!insn->jump_dest) {
                        WARN_FUNC("can't find call dest at %s+0x%lx",