[PATCH 06/27] objtool: Ignore traps after noreturn calls in STT_CODE

From: Josh Poimboeuf

Date: Fri Aug 28 2026 - 00:54:34 EST


Objtool doesn't do unreachable warnings for traps after noreturn calls,
but only in functions. Loongarch assembly STT_CODE can have the same
pattern:

bl start_kernel
ASM_BUG()

Ignore those as well.

Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
tools/objtool/check.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 4528f017277d2..7333b0ed86818 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -4269,12 +4269,6 @@ static bool ignore_unreachable_insn(struct objtool_file *file, struct instructio
!strcmp(insn->sec->name, ".altinstr_aux"))
return true;

- if (!func)
- return false;
-
- if (func->static_call_tramp)
- return true;
-
/*
* CONFIG_UBSAN_TRAP inserts a UD2 when it sees
* __builtin_unreachable(). The BUG() macro has an unreachable() after
@@ -4290,6 +4284,12 @@ static bool ignore_unreachable_insn(struct objtool_file *file, struct instructio
insn->jump_dest && insn->jump_dest->type == INSN_BUG)))
return true;

+ if (!func)
+ return false;
+
+ if (func->static_call_tramp)
+ return true;
+
/*
* Check if this (or a subsequent) instruction is related to
* CONFIG_UBSAN or CONFIG_KASAN.
--
2.55.0