[PATCH v2 08/12] objtool: Ignore jumps to the end of the function for non-CFG arches

From: Josh Poimboeuf

Date: Tue Mar 17 2026 - 18:54:51 EST


Sometimes Clang arm64 code jumps to the end of the function for UB.
No need to make that an error, arm64 doesn't reverse engineer the CFG
anyway.

Acked-by: Song Liu <song@xxxxxxxxxx>
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
tools/objtool/check.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index d428d63b29c6..6e33a29bd3ed 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1630,10 +1630,12 @@ static int add_jump_destinations(struct objtool_file *file)
/*
* GCOV/KCOV dead code can jump to the end of
* the function/section.
+ *
+ * Clang on arm64 also does this sometimes for
+ * undefined behavior.
*/
- if (file->ignore_unreachables && func &&
- dest_sec == insn->sec &&
- dest_off == func->offset + func->len)
+ if ((file->ignore_unreachables || (!opts.stackval && !opts.orc)) &&
+ func && dest_sec == insn->sec && dest_off == func->offset + func->len)
continue;

ERROR_INSN(insn, "can't find jump dest instruction at %s",
--
2.53.0