Skip to content

Commit

Permalink
objtool: Reflow handle_jump_alt()
Browse files Browse the repository at this point in the history
Miroslav figured the code flow in handle_jump_alt() was sub-optimal
with that goto. Reflow the code to make it clearer.

Reported-by: Miroslav Benes <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Link: https://lore.kernel.org/r/YJ00lgslY+IpA/[email protected]
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed May 14, 2021
1 parent d46f61b commit 48001d2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tools/objtool/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -1225,17 +1225,9 @@ static int handle_jump_alt(struct objtool_file *file,
struct instruction *orig_insn,
struct instruction **new_insn)
{
if (orig_insn->type == INSN_NOP) {
do_nop:
if (orig_insn->len == 2)
file->jl_nop_short++;
else
file->jl_nop_long++;
if (orig_insn->type != INSN_JUMP_UNCONDITIONAL &&
orig_insn->type != INSN_NOP) {

return 0;
}

if (orig_insn->type != INSN_JUMP_UNCONDITIONAL) {
WARN_FUNC("unsupported instruction at jump label",
orig_insn->sec, orig_insn->offset);
return -1;
Expand All @@ -1252,7 +1244,15 @@ static int handle_jump_alt(struct objtool_file *file,
orig_insn->offset, orig_insn->len,
arch_nop_insn(orig_insn->len));
orig_insn->type = INSN_NOP;
goto do_nop;
}

if (orig_insn->type == INSN_NOP) {
if (orig_insn->len == 2)
file->jl_nop_short++;
else
file->jl_nop_long++;

return 0;
}

if (orig_insn->len == 2)
Expand Down

0 comments on commit 48001d2

Please sign in to comment.