Skip to content

Commit f0bc12b

Browse files
Peter Zijlstragregkh
authored andcommitted
objtool: Fix static_call list generation
[ Upstream commit a958c4f ] Currently, objtool generates tail call entries in add_jump_destination() but waits until validate_branch() to generate the regular call entries. Move these to add_call_destination() for consistency. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Link: https://lkml.kernel.org/r/20210326151259.691529901@infradead.org Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b36ab50 commit f0bc12b

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

‎tools/objtool/check.c‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,11 @@ static int add_call_destinations(struct objtool_file *file)
954954
} else
955955
insn->call_dest = reloc->sym;
956956

957+
if (insn->call_dest && insn->call_dest->static_call_tramp) {
958+
list_add_tail(&insn->static_call_node,
959+
&file->static_call_list);
960+
}
961+
957962
/*
958963
* Many compilers cannot disable KCOV with a function attribute
959964
* so they need a little help, NOP out any KCOV calls from noinstr
@@ -1668,6 +1673,9 @@ static int decode_sections(struct objtool_file *file)
16681673
if (ret)
16691674
return ret;
16701675

1676+
/*
1677+
* Must be before add_{jump_call}_destination.
1678+
*/
16711679
ret = read_static_call_tramps(file);
16721680
if (ret)
16731681
return ret;
@@ -1680,6 +1688,10 @@ static int decode_sections(struct objtool_file *file)
16801688
if (ret)
16811689
return ret;
16821690

1691+
/*
1692+
* Must be before add_call_destination(); it changes INSN_CALL to
1693+
* INSN_JUMP.
1694+
*/
16831695
ret = read_intra_function_calls(file);
16841696
if (ret)
16851697
return ret;
@@ -2534,11 +2546,6 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
25342546
if (dead_end_function(file, insn->call_dest))
25352547
return 0;
25362548

2537-
if (insn->type == INSN_CALL && insn->call_dest->static_call_tramp) {
2538-
list_add_tail(&insn->static_call_node,
2539-
&file->static_call_list);
2540-
}
2541-
25422549
break;
25432550

25442551
case INSN_JUMP_CONDITIONAL:

0 commit comments

Comments
 (0)