[PATCH v5 02/15] objtool: Move back misplaced comment
From: Christophe Leroy <hidden>
Date: 2025-01-15 22:51:09
Also in:
lkml, llvm
Subsystem:
objtool, the rest · Maintainers:
Josh Poimboeuf, Peter Zijlstra, Linus Torvalds
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 <redacted>
---
tools/objtool/arch/x86/special.c | 5 -----
tools/objtool/check.c | 6 ++++++
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/tools/objtool/arch/x86/special.c b/tools/objtool/arch/x86/special.c
index 9c1c9df09aaa..76c7933bcb19 100644
--- a/tools/objtool/arch/x86/special.c
+++ b/tools/objtool/arch/x86/special.c@@ -142,11 +142,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;
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 129c4e2245ae..58d9b1a750e3 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c@@ -2036,6 +2036,12 @@ static void find_jump_table(struct objtool_file *file, struct symbol *func, table_reloc = arch_find_switch_table(file, insn, &table_size); 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;
--
2.47.0