diff options
author | Josh Poimboeuf <jpoimboe@kernel.org> | 2025-01-15 00:57:58 +0300 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2025-02-08 17:43:08 +0300 |
commit | 3724062ca2b1364f02cf44dbea1a552227844ad1 (patch) | |
tree | 161987518637f1e0b9aa26342c4dfa38e2afa612 /tools | |
parent | 2014c95afecee3e76ca4a56956a936e23283f05b (diff) | |
download | linux-3724062ca2b1364f02cf44dbea1a552227844ad1.tar.xz |
objtool: Ignore dangling jump table entries
Clang sometimes leaves dangling unused jump table entries which point to
the end of the function. Ignore them.
Closes: https://lore.kernel.org/20250113235835.vqgvb7cdspksy5dn@jpoimboe
Reported-by: Klaus Kusche <klaus.kusche@computerix.info>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/ee25c0b7e80113e950bd1d4c208b671d35774ff4.1736891751.git.jpoimboe@kernel.org
Diffstat (limited to 'tools')
-rw-r--r-- | tools/objtool/check.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 753dbc4f8198..3520a45ebde8 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1975,6 +1975,14 @@ static int add_jump_table(struct objtool_file *file, struct instruction *insn, reloc_addend(reloc) == pfunc->offset) break; + /* + * Clang sometimes leaves dangling unused jump table entries + * which point to the end of the function. Ignore them. + */ + if (reloc->sym->sec == pfunc->sec && + reloc_addend(reloc) == pfunc->offset + pfunc->len) + goto next; + dest_insn = find_insn(file, reloc->sym->sec, reloc_addend(reloc)); if (!dest_insn) break; @@ -1992,6 +2000,7 @@ static int add_jump_table(struct objtool_file *file, struct instruction *insn, alt->insn = dest_insn; alt->next = insn->alts; insn->alts = alt; +next: prev_offset = reloc_offset(reloc); } |