[PATCH v2 16/27] objtool: Detect noreturns in weak functions

From: Josh Poimboeuf

Date: Tue Sep 08 2026 - 16:44:30 EST


The skipping of weak functions in the noreturn detection logic is a bit
weird, as a function's return/noreturn ABI shouldn't change regardless
of which version gets linked.

Fix that, and update the global noreturns list as needed.

Note that abort() now needs to be added to the list: while objtool on
vmlinux.o can detect that its noreturn, modules have no way of knowing.

Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
tools/objtool/check.c | 3 ---
tools/objtool/noreturns.h | 3 +--
2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index d3b5c372cba4a..35e24151f5785 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -262,9 +262,6 @@ static bool might_return(struct objtool_file *file, struct symbol *func)
struct instruction *insn;
struct symbol *dest;

- if (is_weak_sym(func))
- return true;
-
func_for_each_insn(file, func, insn) {
if (insn->type == INSN_RETURN)
return true;
diff --git a/tools/objtool/noreturns.h b/tools/objtool/noreturns.h
index cd41f580ccb72..26f62f98bc8ef 100644
--- a/tools/objtool/noreturns.h
+++ b/tools/objtool/noreturns.h
@@ -11,15 +11,14 @@ NORETURN(__kunit_abort)
NORETURN(__module_put_and_kthread_exit)
NORETURN(__stack_chk_fail)
NORETURN(__ubsan_handle_builtin_unreachable)
+NORETURN(abort)
NORETURN(acpi_processor_ffh_play_dead)
NORETURN(do_exit)
NORETURN(kthread_complete_and_exit)
NORETURN(kunit_try_catch_throw)
NORETURN(mpt_halt_firmware)
-NORETURN(nmi_panic_self_stop)
NORETURN(panic)
NORETURN(vpanic)
-NORETURN(panic_smp_self_stop)
NORETURN(rewind_stack_and_make_dead)
NORETURN(rust_helper_BUG)
NORETURN(sev_es_terminate)
--
2.55.0