aboutsummaryrefslogtreecommitdiffstats
path: root/tools/objtool
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2021-05-13 16:15:50 +0200
committerIngo Molnar <mingo@kernel.org>2021-05-14 09:00:10 +0200
commit48001d26c19f02c33795829ec9fc71a0d8d42413 (patch)
tree691628dac76000f2ccd80085899f89302e357e00 /tools/objtool
parentjump_label/x86: Remove unused JUMP_LABEL_NOP_SIZE (diff)
downloadlinux-dev-48001d26c19f02c33795829ec9fc71a0d8d42413.tar.xz
linux-dev-48001d26c19f02c33795829ec9fc71a0d8d42413.zip
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: Miroslav Benes <mbenes@suse.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/YJ00lgslY+IpA/rL@hirez.programming.kicks-ass.net
Diffstat (limited to 'tools/objtool')
-rw-r--r--tools/objtool/check.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 2c6a93edf27e..e5947fbb9e7a 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -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;
@@ -1252,7 +1244,15 @@ do_nop:
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)