Commit 48001d26 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

objtool: Reflow handle_jump_alt()

Miroslav figured the code flow in handle_jump_alt() was sub-optimal
with that goto. Reflow the code to make it clearer.
Reported-by: default avatarMiroslav Benes <mbenes@suse.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/YJ00lgslY+IpA/rL@hirez.programming.kicks-ass.net
parent d46f61b2
...@@ -1225,17 +1225,9 @@ static int handle_jump_alt(struct objtool_file *file, ...@@ -1225,17 +1225,9 @@ static int handle_jump_alt(struct objtool_file *file,
struct instruction *orig_insn, struct instruction *orig_insn,
struct instruction **new_insn) struct instruction **new_insn)
{ {
if (orig_insn->type == INSN_NOP) { if (orig_insn->type != INSN_JUMP_UNCONDITIONAL &&
do_nop: orig_insn->type != INSN_NOP) {
if (orig_insn->len == 2)
file->jl_nop_short++;
else
file->jl_nop_long++;
return 0;
}
if (orig_insn->type != INSN_JUMP_UNCONDITIONAL) {
WARN_FUNC("unsupported instruction at jump label", WARN_FUNC("unsupported instruction at jump label",
orig_insn->sec, orig_insn->offset); orig_insn->sec, orig_insn->offset);
return -1; return -1;
...@@ -1252,7 +1244,15 @@ static int handle_jump_alt(struct objtool_file *file, ...@@ -1252,7 +1244,15 @@ static int handle_jump_alt(struct objtool_file *file,
orig_insn->offset, orig_insn->len, orig_insn->offset, orig_insn->len,
arch_nop_insn(orig_insn->len)); arch_nop_insn(orig_insn->len));
orig_insn->type = INSN_NOP; 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) if (orig_insn->len == 2)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment