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

Josh Poimboeuf <[email protected]>
Newsgroups gmane.linux.kbuild.devel,gmane.linux.kernel,gmane.linux.kernel.rust
Message-ID <44e198b8eb0f377b5e2c61cf6bb753d735201bd7.1787890035.git.jpoimboe@kernel.org>
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 <[email protected]>
---
 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.