objtool/rust: add more `noreturn` Rust functions for Rust 1.101.0
Subsystems (3)
Miguel Ojeda
maintainerPATCH 1/1 objtool/rust: add more `noreturn` Rust functions for Rust 1.101.0
Starting with Rust 1.101.0 (expected 2026-12-24), objtool may report:
rust/kernel.o: warning: objtool: _R..._6kernel3pci2ioINtB7_6DeviceNtNtB9_6device5BoundE8cfg_size() falls through to next function _R..._6kernel3oppNtB5_3OPP18from_raw_opp_owned()
(and others) due to calls to the noreturn symbol:
core::panicking::unreachable_default_msg
Rust now outlines the constant messages of the panicking macros [1], thus unreachable!() (i.e. without arguments) calls that new function instead of core::panicking::panic, which is already in the list.
The same change introduced the equivalent noreturn functions for panic!(), todo!() and unimplemented!(), which lead to the same warning when those are used:
core::panicking::panic_default_msg
core::panicking::todo_default_msg
core::panicking::unimplemented_default_msg
Thus add the mangled ones to the list so that objtool knows they are actually noreturn.
See commit 56d680dd23c3 ("objtool/rust: list noreturn Rust functions") for more details.
--- tools/objtool/check.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/objtool/check.c +4 -0
@@ -206,9 +206,13 @@ static bool is_rust_noreturn(const struct symbol *func)str_ends_with (func->name,"_4core9panicking9panic_fmt" ) ||str_ends_with (func->name,"_4core9panicking14panic_explicit" ) ||str_ends_with (func->name,"_4core9panicking14panic_nounwind" ) || +str_ends_with (func->name,"_4core9panicking16todo_default_msg" ) || +str_ends_with (func->name,"_4core9panicking17panic_default_msg" ) ||str_ends_with (func->name,"_4core9panicking18panic_bounds_check" ) ||str_ends_with (func->name,"_4core9panicking18panic_nounwind_fmt" ) ||str_ends_with (func->name,"_4core9panicking19assert_failed_inner" ) || +str_ends_with (func->name,"_4core9panicking23unreachable_default_msg" ) || +str_ends_with (func->name,"_4core9panicking25unimplemented_default_msg" ) ||str_ends_with (func->name,"_4core9panicking30panic_null_pointer_dereference" ) ||str_ends_with (func->name,"_4core9panicking32panic_null_reference_constructed" ) || str_ends_with(func->name, "_4core9panicking36panic_misaligned_pointer_dereference") ||
base-commit: ee83899302a0457a3ba47464a13e8682bd7ba27d
Signature · 1 line
2.56.0
Quoted 24 lines · Miguel Ojeda
Starting with Rust 1.101.0 (expected 2026-12-24),
objtoolmay report:
rust/kernel.o: warning: objtool: _R..._6kernel3pci2ioINtB7_6DeviceNtNtB9_6device5BoundE8cfg_size() falls through to next function _R..._6kernel3oppNtB5_3OPP18from_raw_opp_owned()(and others) due to calls to the
noreturnsymbol:
core::panicking::unreachable_default_msgRust now outlines the constant messages of the panicking macros [1], thus
unreachable!()(i.e. without arguments) calls that new function instead ofcore::panicking::panic, which is already in the list.The same change introduced the equivalent
noreturnfunctions forpanic!(),todo!()andunimplemented!(), which lead to the same warning when those are used:
core::panicking::panic_default_msg
core::panicking::todo_default_msg
core::panicking::unimplemented_default_msgThus add the mangled ones to the list so that
objtoolknows they are actuallynoreturn.
Quoted 8 lines
See commit
56d680dd23c3("objtool/rust: listnoreturnRust functions") for more details.Cc [email protected] # 6.12.x (Rust is pinned in older LTSs)Cc Josh Poimboeuf <[email protected]>Cc Peter Zijlstra <[email protected]>Signed-off-by Miguel Ojeda <[email protected]>
Quoted 3 lines
--- tools/objtool/check.c | 4 ++++ 1 file changed, 4 insertions(+)
Miguel Ojeda
AppliedQuoted 25 lines · Miguel Ojeda
Starting with Rust 1.101.0 (expected 2026-12-24),
objtoolmay report:
rust/kernel.o: warning: objtool: _R..._6kernel3pci2ioINtB7_6DeviceNtNtB9_6device5BoundE8cfg_size() falls through to next function _R..._6kernel3oppNtB5_3OPP18from_raw_opp_owned()(and others) due to calls to the
noreturnsymbol:
core::panicking::unreachable_default_msgRust now outlines the constant messages of the panicking macros [1], thus
unreachable!()(i.e. without arguments) calls that new function instead ofcore::panicking::panic, which is already in the list.The same change introduced the equivalent
noreturnfunctions forpanic!(),todo!()andunimplemented!(), which lead to the same warning when those are used:
core::panicking::panic_default_msg
core::panicking::todo_default_msg
core::panicking::unimplemented_default_msgThus add the mangled ones to the list so that
objtoolknows they are actuallynoreturn.
Quoted 8 lines
See commit
56d680dd23c3("objtool/rust: listnoreturnRust functions") for more details.Cc [email protected] # 6.12.x (Rust is pinned in older LTSs)Cc Josh Poimboeuf <[email protected]>Cc Peter Zijlstra <[email protected]>Signed-off-by Miguel Ojeda <[email protected]>
Applied to rust-fixes -- thanks everyone!
Cheers,
Miguel