objtool: Improve __noreturn annotation warning
authorJosh Poimboeuf <jpoimboe@kernel.org>
Fri, 14 Mar 2025 19:29:01 +0000 (12:29 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 17 Mar 2025 10:36:00 +0000 (11:36 +0100)
Clarify what needs to be done to resolve the missing __noreturn warning.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/ab835a35d00bacf8aff0b56257df93f14fdd8224.1741975349.git.jpoimboe@kernel.org
tools/objtool/Documentation/objtool.txt
tools/objtool/check.c

index 7c3ee959b63c71deffc44a84f46d0994a8153103..87950a7aaa17f0d0314e9178e9f8778955f63856 100644 (file)
@@ -319,14 +319,12 @@ the objtool maintainers.
    a just a bad person, you can tell objtool to ignore it.  See the
    "Adding exceptions" section below.
 
-   If it's not actually in a callable function (e.g. kernel entry code),
-   change ENDPROC to END.
+3. file.o: warning: objtool: foo+0x48c: bar() missing __noreturn in .c/.h or NORETURN() in noreturns.h
 
-3. file.o: warning: objtool: foo+0x48c: bar() is missing a __noreturn annotation
-
-   The call from foo() to bar() doesn't return, but bar() is missing the
-   __noreturn annotation.  NOTE: In addition to annotating the function
-   with __noreturn, please also add it to tools/objtool/noreturns.h.
+   The call from foo() to bar() doesn't return, but bar() is incorrectly
+   annotated.  A noreturn function must be marked __noreturn in both its
+   declaration and its definition, and must have a NORETURN() annotation
+   in tools/objtool/noreturns.h.
 
 4. file.o: warning: objtool: func(): can't find starting instruction
    or
index e68a89efc5fe9d6c5ff4925f75c8549a42d37351..d6af5385baf6147df179187d75c2143dbd0c908c 100644 (file)
@@ -4477,7 +4477,7 @@ static int validate_reachable_instructions(struct objtool_file *file)
                if (prev_insn && prev_insn->dead_end) {
                        call_dest = insn_call_dest(prev_insn);
                        if (call_dest) {
-                               WARN_INSN(insn, "%s() is missing a __noreturn annotation",
+                               WARN_INSN(insn, "%s() missing __noreturn in .c/.h or NORETURN() in noreturns.h",
                                          call_dest->name);
                                warnings++;
                                continue;