Skip to content

Commit acae6b5

Browse files
jpoimboePeter Zijlstra
authored andcommitted
objtool: Improve __noreturn annotation warning
Clarify what needs to be done to resolve the missing __noreturn warning. Signed-off-by: Josh Poimboeuf <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/ab835a35d00bacf8aff0b56257df93f14fdd8224.1741975349.git.jpoimboe@kernel.org
1 parent b745962 commit acae6b5

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

tools/objtool/Documentation/objtool.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,12 @@ the objtool maintainers.
319319
a just a bad person, you can tell objtool to ignore it. See the
320320
"Adding exceptions" section below.
321321

322-
If it's not actually in a callable function (e.g. kernel entry code),
323-
change ENDPROC to END.
322+
3. file.o: warning: objtool: foo+0x48c: bar() missing __noreturn in .c/.h or NORETURN() in noreturns.h
324323

325-
3. file.o: warning: objtool: foo+0x48c: bar() is missing a __noreturn annotation
326-
327-
The call from foo() to bar() doesn't return, but bar() is missing the
328-
__noreturn annotation. NOTE: In addition to annotating the function
329-
with __noreturn, please also add it to tools/objtool/noreturns.h.
324+
The call from foo() to bar() doesn't return, but bar() is incorrectly
325+
annotated. A noreturn function must be marked __noreturn in both its
326+
declaration and its definition, and must have a NORETURN() annotation
327+
in tools/objtool/noreturns.h.
330328

331329
4. file.o: warning: objtool: func(): can't find starting instruction
332330
or

tools/objtool/check.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4477,7 +4477,7 @@ static int validate_reachable_instructions(struct objtool_file *file)
44774477
if (prev_insn && prev_insn->dead_end) {
44784478
call_dest = insn_call_dest(prev_insn);
44794479
if (call_dest) {
4480-
WARN_INSN(insn, "%s() is missing a __noreturn annotation",
4480+
WARN_INSN(insn, "%s() missing __noreturn in .c/.h or NORETURN() in noreturns.h",
44814481
call_dest->name);
44824482
warnings++;
44834483
continue;

0 commit comments

Comments
 (0)