[PATCH v3 10/21] objtool: Ignore jumps to the end of the function for checksum runs
Josh Poimboeuf
jpoimboe at kernel.org
Tue May 12 20:34:06 PDT 2026
Sometimes Clang arm64 code jumps to the end of the function for UB.
No need to make that an error for checksum runs.
Signed-off-by: Josh Poimboeuf <jpoimboe at kernel.org>
---
tools/objtool/check.c | 42 +++++++++++++++++++++++-------------------
1 file changed, 23 insertions(+), 19 deletions(-)
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 10b18cf9c3608..73451aef68029 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -37,6 +37,22 @@ struct disas_context *objtool_disas_ctx;
size_t sym_name_max_len;
+static bool validate_branch_enabled(void)
+{
+ return opts.stackval ||
+ opts.orc ||
+ opts.uaccess;
+}
+
+static bool alts_needed(void)
+{
+ return validate_branch_enabled() ||
+ opts.noinstr ||
+ opts.hack_jump_label ||
+ opts.disas ||
+ opts.checksum;
+}
+
struct instruction *find_insn(struct objtool_file *file,
struct section *sec, unsigned long offset)
{
@@ -1593,10 +1609,14 @@ 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 (!validate_branch_enabled() ||
+ (file->ignore_unreachables && func &&
+ dest_sec == insn->sec &&
+ dest_off == func->offset + func->len))
continue;
ERROR_INSN(insn, "can't find jump dest instruction at %s",
@@ -2584,22 +2604,6 @@ static void mark_holes(struct objtool_file *file)
}
}
-static bool validate_branch_enabled(void)
-{
- return opts.stackval ||
- opts.orc ||
- opts.uaccess;
-}
-
-static bool alts_needed(void)
-{
- return validate_branch_enabled() ||
- opts.noinstr ||
- opts.hack_jump_label ||
- opts.disas ||
- opts.checksum;
-}
-
int decode_file(struct objtool_file *file)
{
arch_initial_func_cfi_state(&initial_func_cfi);
--
2.53.0
More information about the linux-arm-kernel
mailing list