Re: [PATCH 4/9] objtool: Fix static_call list generation

2021-03-16 Thread Josh Poimboeuf
On Fri, Mar 12, 2021 at 06:16:17PM +0100, Peter Zijlstra wrote:
> @@ -1701,6 +1706,9 @@ static int decode_sections(struct objtoo
>   if (ret)
>   return ret;
>  
> + /*
> +  * Must be before add_{jump_call}_desetination.
> +  */

s/desetination/destination/

-- 
Josh



[PATCH 4/9] objtool: Fix static_call list generation

2021-03-12 Thread Peter Zijlstra
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) 
---
 tools/objtool/check.c |   17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -974,6 +974,11 @@ static int add_call_destinations(struct
} else
insn->call_dest = reloc->sym;
 
+   if (insn->call_dest && insn->call_dest->static_call_tramp) {
+   list_add_tail(>static_call_node,
+ >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
@@ -1701,6 +1706,9 @@ static int decode_sections(struct objtoo
if (ret)
return ret;
 
+   /*
+* Must be before add_{jump_call}_desetination.
+*/
ret = read_static_call_tramps(file);
if (ret)
return ret;
@@ -1717,6 +1725,10 @@ static int decode_sections(struct objtoo
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;
@@ -2659,11 +2671,6 @@ static int validate_branch(struct objtoo
if (dead_end_function(file, insn->call_dest))
return 0;
 
-   if (insn->type == INSN_CALL && 
insn->call_dest->static_call_tramp) {
-   list_add_tail(>static_call_node,
- >static_call_list);
-   }
-
break;
 
case INSN_JUMP_CONDITIONAL: