Skip to contentSkip to conversation

objtool/rust: add more `noreturn` Rust functions for Rust 1.101.0

PATCH Applied Miguel Ojeda 3 participants 3 messages Nov 14 – Nov 17

Subsystems (3)
lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 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.

Cc [email protected] # 6.12.x (Rust is pinned in older LTSs)
Cc Josh Poimboeuf <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/objtool/check.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/objtool/check.c +4 -0
index 931c5c412f15..4ef5bf97d333 100644
@@ -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
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · Miguel Ojeda

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.

Quoted 8 lines

See commit 56d680dd23c3 ("objtool/rust: list noreturn Rust 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]>
Quoted 3 lines
---
 tools/objtool/check.c | 4 ++++
 1 file changed, 4 insertions(+)
Applied
#2 lore raw
In reply to Miguel Ojeda
Quoted 25 lines · Miguel Ojeda

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.

Quoted 8 lines

See commit 56d680dd23c3 ("objtool/rust: list noreturn Rust 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]>

Applied to rust-fixes -- thanks everyone!

Cheers,
Miguel