[PATCH 10/14] objtool: Ignore jumps to the end of the function for non-CFG arches

From: Josh Poimboeuf

Date: Wed Mar 04 2026 - 22:32:36 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.

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 f73cf1382e5c..23cde2de66b9 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