diff options
-rw-r--r-- | tools/objtool/builtin-check.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c index 143b6cdd7f06..a00a05d287e7 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c | |||
@@ -713,6 +713,7 @@ static struct rela *find_switch_table(struct objtool_file *file, | |||
713 | struct instruction *insn) | 713 | struct instruction *insn) |
714 | { | 714 | { |
715 | struct rela *text_rela, *rodata_rela; | 715 | struct rela *text_rela, *rodata_rela; |
716 | struct instruction *orig_insn = insn; | ||
716 | 717 | ||
717 | text_rela = find_rela_by_dest_range(insn->sec, insn->offset, insn->len); | 718 | text_rela = find_rela_by_dest_range(insn->sec, insn->offset, insn->len); |
718 | if (text_rela && text_rela->sym == file->rodata->sym) { | 719 | if (text_rela && text_rela->sym == file->rodata->sym) { |
@@ -733,10 +734,16 @@ static struct rela *find_switch_table(struct objtool_file *file, | |||
733 | 734 | ||
734 | /* case 3 */ | 735 | /* case 3 */ |
735 | func_for_each_insn_continue_reverse(file, func, insn) { | 736 | func_for_each_insn_continue_reverse(file, func, insn) { |
736 | if (insn->type == INSN_JUMP_UNCONDITIONAL || | 737 | if (insn->type == INSN_JUMP_DYNAMIC) |
737 | insn->type == INSN_JUMP_DYNAMIC) | ||
738 | break; | 738 | break; |
739 | 739 | ||
740 | /* allow small jumps within the range */ | ||
741 | if (insn->type == INSN_JUMP_UNCONDITIONAL && | ||
742 | insn->jump_dest && | ||
743 | (insn->jump_dest->offset <= insn->offset || | ||
744 | insn->jump_dest->offset >= orig_insn->offset)) | ||
745 | break; | ||
746 | |||
740 | text_rela = find_rela_by_dest_range(insn->sec, insn->offset, | 747 | text_rela = find_rela_by_dest_range(insn->sec, insn->offset, |
741 | insn->len); | 748 | insn->len); |
742 | if (text_rela && text_rela->sym == file->rodata->sym) | 749 | if (text_rela && text_rela->sym == file->rodata->sym) |