@@ -118,11 +118,6 @@ struct reloc *arch_find_switch_table(struct objtool_file *file,
strcmp(table_sec->name, C_JUMP_TABLE_SECTION))
return NULL;
- /*
- * Each table entry has a rela associated with it. The rela
- * should reference text in the same function as the original
- * instruction.
- */
rodata_reloc = find_reloc_by_dest(file->elf, table_sec, table_offset);
if (!rodata_reloc)
return NULL;
@@ -2072,6 +2072,12 @@ static struct reloc *find_jump_table(struct objtool_file *file,
table_reloc = arch_find_switch_table(file, insn);
if (!table_reloc)
continue;
+
+ /*
+ * Each table entry has a rela associated with it. The rela
+ * should reference text in the same function as the original
+ * instruction.
+ */
dest_insn = find_insn(file, table_reloc->sym->sec, reloc_addend(table_reloc));
if (!dest_insn || !insn_func(dest_insn) || insn_func(dest_insn)->pfunc != func)
continue;
A comment was introduced by commit 113d4bc90483 ("objtool: Fix clang switch table edge case") and wrongly moved by commit d871f7b5a6a2 ("objtool: Refactor jump table code to support other architectures") without the piece of code added with the comment in the original commit. Fixes: d871f7b5a6a2 ("objtool: Refactor jump table code to support other architectures") Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> --- tools/objtool/arch/x86/special.c | 5 ----- tools/objtool/check.c | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-)