Skip to content

Linux build: fix noreturn and silence spurious falls through objtools warnings #17442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

AttilaFueloep
Copy link
Contributor

Motivation and Context

Follow-up for #17410

Objtool correctly complains that spl_panic() and luaD_throw() are missing an attribute((noreturn)) annotation. Unfortunately, adding the attribute results in a ton of spurious falls through to next function warnings. This is documented [1], so I patched objtool to include spl_panic() and luaD_throw() in the global noreturn functions list [2] and indeed all spl related (see below) warnings are gone.

Description

Getting the objtool maintainer to add our functions to this list isn't likely to be a viable path. Therefore I took a differnet approach and silenced them via the --no-unreachable objtool flag, they were false positives anyway. The first commit leaves us with lua{,L}_error() noreturn warnings which are also silenced by the second commit. Obviously they should be fixed as well, but I'd rather prefer to do this in a subsequent PR since it's a bit more involved (changing function return types).

[1] https://github.com/torvalds/linux/blob/7a912d04415b372324e5a8dfad3360d993d0c23a/tools/objtool/Documentation/objtool.txt#L388-L399

[2] https://github.com/torvalds/linux/blob/v6.15/tools/objtool/noreturns.h
https://github.com/torvalds/linux/blob/7a912d04415b372324e5a8dfad3360d993d0c23a/tools/objtool/check.c#L255-L257

How Has This Been Tested?

Build locally and verified that no objtool warnings are left.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

Objtool correctly complains that `spl_panic()` and `luaD_throw()`
are missing an `atribute((noreturn))` annotation. They were in
place but removed in a previous commit to work around spurious
objtool warnings they caused.

Add them back in, the spurious warnings are addressed in a separate
commit.

Signed-off-by: Attila Fülöp <[email protected]>
If we correctly annotate noreturn functions we end up with a ton of
spurious `falls through to next function` objtool warnings during
the build.

Silence them by skipping objtools unreachable checks. Please note
that this will skip the noreturn checks as well. The proper fix
would be to ask the objtool maintainers to add our noreturn
functions to their `noretuns.h` header file.

Signed-off-by: Attila Fülöp <[email protected]>
@AttilaFueloep AttilaFueloep force-pushed the zfs-silence-objtool-noret-fallthrough branch from 436d216 to a3f978d Compare June 8, 2025 23:47
@AttilaFueloep
Copy link
Contributor Author

AttilaFueloep commented Jun 9, 2025

This is like fighting Hydra.

@AttilaFueloep AttilaFueloep marked this pull request as draft June 9, 2025 12:59
@github-actions github-actions bot added the Status: Work in Progress Not yet ready for general review label Jun 9, 2025
@AttilaFueloep
Copy link
Contributor Author

I'm at a loss. This works perfectly fine with the standard ArchLinux 6.14 kernel. It somewhat works with Fedora but creates a new set of warnings. On Debian/Ubuntu/Alma it completely fails to silence the falls through warnings, although in theory, it should work with kernels >= 5.13.

@AttilaFueloep
Copy link
Contributor Author

AttilaFueloep commented Jun 10, 2025

Seems to need Linux 6.14., older versions still warn. The flag exists since 4.14 but won't silence the warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Work in Progress Not yet ready for general review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant