objtool: Ignore dangling jump table entries
[ Upstream commit 3724062ca2 ]
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
be2051f81b
commit
5b1c48532f
@@ -2028,6 +2028,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;
|
||||
@@ -2045,6 +2053,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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user