Skip to content

Commit a958c4f

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
objtool: Fix static_call list generation
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) <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Miroslav Benes <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 530b4dd commit a958c4f

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

tools/objtool/check.c

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

1048+
if (insn->call_dest && insn->call_dest->static_call_tramp) {
1049+
list_add_tail(&insn->static_call_node,
1050+
&file->static_call_list);
1051+
}
1052+
10481053
/*
10491054
* Many compilers cannot disable KCOV with a function attribute
10501055
* so they need a little help, NOP out any KCOV calls from noinstr
@@ -1788,6 +1793,9 @@ static int decode_sections(struct objtool_file *file)
17881793
if (ret)
17891794
return ret;
17901795

1796+
/*
1797+
* Must be before add_{jump_call}_destination.
1798+
*/
17911799
ret = read_static_call_tramps(file);
17921800
if (ret)
17931801
return ret;
@@ -1800,6 +1808,10 @@ static int decode_sections(struct objtool_file *file)
18001808
if (ret)
18011809
return ret;
18021810

1811+
/*
1812+
* Must be before add_call_destination(); it changes INSN_CALL to
1813+
* INSN_JUMP.
1814+
*/
18031815
ret = read_intra_function_calls(file);
18041816
if (ret)
18051817
return ret;
@@ -2762,11 +2774,6 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
27622774
if (dead_end_function(file, insn->call_dest))
27632775
return 0;
27642776

2765-
if (insn->type == INSN_CALL && insn->call_dest->static_call_tramp) {
2766-
list_add_tail(&insn->static_call_node,
2767-
&file->static_call_list);
2768-
}
2769-
27702777
break;
27712778

27722779
case INSN_JUMP_CONDITIONAL:

0 commit comments

Comments
 (0)