diff options
| author | Josh Poimboeuf <jpoimboe@kernel.org> | 2025-01-14 13:57:58 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-03-22 12:56:47 -0700 |
| commit | d8f12a29670c24a2df5de0d4a7761b8ad9218dd4 (patch) | |
| tree | 388804ca146e071804be371241f86907cbfe48eb /tools | |
| parent | 19fe2fefd7664eba633bb24ea963aa305763ace4 (diff) | |
| download | linux-d8f12a29670c24a2df5de0d4a7761b8ad9218dd4.tar.gz linux-d8f12a29670c24a2df5de0d4a7761b8ad9218dd4.tar.bz2 linux-d8f12a29670c24a2df5de0d4a7761b8ad9218dd4.zip | |
objtool: Ignore dangling jump table entries
[ Upstream commit 3724062ca2b1364f02cf44dbea1a552227844ad1 ]
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
Signed-off-by: Sasha Levin <sashal@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 6691bd106e4b..6f3f408d0a01 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -2061,6 +2061,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; @@ -2078,6 +2086,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); } |
