summaryrefslogtreecommitdiff
path: root/tools/objtool
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2021-03-26 18:12:05 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-11-18 16:04:02 +0300
commitf0bc12b8482684fe4d0e48b367ca4fcb8580e81a (patch)
treebe43481f4465276dbc00dad97d167d3ed5a0dbab /tools/objtool
parentb36ab509e1817e60f73ce297494f0de1b7ed2c08 (diff)
downloadlinux-f0bc12b8482684fe4d0e48b367ca4fcb8580e81a.tar.xz
objtool: Fix static_call list generation
[ Upstream commit a958c4fea768d2c378c89032ab41d38da2a24422 ] 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>
Diffstat (limited to 'tools/objtool')
-rw-r--r--tools/objtool/check.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 4261f93ce06f..8932f41c387f 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -954,6 +954,11 @@ static int add_call_destinations(struct objtool_file *file)
} else
insn->call_dest = reloc->sym;
+ if (insn->call_dest && insn->call_dest->static_call_tramp) {
+ list_add_tail(&insn->static_call_node,
+ &file->static_call_list);
+ }
+
/*
* Many compilers cannot disable KCOV with a function attribute
* 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)
if (ret)
return ret;
+ /*
+ * Must be before add_{jump_call}_destination.
+ */
ret = read_static_call_tramps(file);
if (ret)
return ret;
@@ -1680,6 +1688,10 @@ static int decode_sections(struct objtool_file *file)
if (ret)
return ret;
+ /*
+ * Must be before add_call_destination(); it changes INSN_CALL to
+ * INSN_JUMP.
+ */
ret = read_intra_function_calls(file);
if (ret)
return ret;
@@ -2534,11 +2546,6 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
if (dead_end_function(file, insn->call_dest))
return 0;
- if (insn->type == INSN_CALL && insn->call_dest->static_call_tramp) {
- list_add_tail(&insn->static_call_node,
- &file->static_call_list);
- }
-
break;
case INSN_JUMP_CONDITIONAL: