Skip to contentSkip to conversation

objtool/rust: relax slice condition to cover more `noreturn` Rust functions

PATCH Applied Miguel Ojeda 3 participants 3 messages May 20, 2025 – May 22, 2025

Subsystems (3)
lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/1 objtool/rust: relax slice condition to cover more `noreturn` Rust functions

Developers are indeed hitting other of the noreturn slice symbols in Nova [1], thus relax the last check in the list so that we catch all of them, i.e.

*_4core5slice5index22slice_index_order_fail *_4core5slice5index24slice_end_index_len_fail *_4core5slice5index26slice_start_index_len_fail *_4core5slice5index29slice_end_index_overflow_fail *_4core5slice5index31slice_start_index_overflow_fail

These all exist since at least Rust 1.78.0, thus backport it too.

See commit 56d680dd23c3 ("objtool/rust: list noreturn Rust functions") for more details.

---
I tested it with the Timur's alex branch, but a Tested-by is appreciated. Thanks!

 tools/objtool/check.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/objtool/check.c +2 -1
index b21b12ec88d9..f23bdda737aa 100644
@@ -230,7 +230,8 @@ static bool is_rust_noreturn(const struct symbol *func)
 	       str_ends_with(func->name, "_7___rustc17rust_begin_unwind")				||
 	       strstr(func->name, "_4core9panicking13assert_failed")					||
 	       strstr(func->name, "_4core9panicking11panic_const24panic_const_")			||
-	       (strstr(func->name, "_4core5slice5index24slice_") &&
+	       (strstr(func->name, "_4core5slice5index") &&
+		strstr(func->name, "slice_") &&
 		str_ends_with(func->name, "_fail"));
 }
 

base-commit: a5806cd506af5a7c19bcd596e4708b5c464bfd21 --
2.49.0

Tested-by on v1 1/1
#1 lore raw
Quoted 15 lines · Miguel Ojeda

Developers are indeed hitting other of the noreturn slice symbols in Nova [1], thus relax the last check in the list so that we catch all of them, i.e.

*_4core5slice5index22slice_index_order_fail *_4core5slice5index24slice_end_index_len_fail *_4core5slice5index26slice_start_index_len_fail *_4core5slice5index29slice_end_index_overflow_fail *_4core5slice5index31slice_start_index_overflow_fail

These all exist since at least Rust 1.78.0, thus backport it too.

See commit 56d680dd23c3 ("objtool/rust: list noreturn Rust functions") for more details.

Quoted 7 lines
Cc [email protected] # Needed in 6.12.y and later.
Cc John Hubbard <[email protected]>
Cc Timur Tabi <[email protected]>
Cc Kane York <[email protected]>
Cc Josh Poimboeuf <[email protected]>
Cc Peter Zijlstra <[email protected]>

Fixes our nova-core warnings.

thanks,

- Joel

Quoted 27 lines

---
I tested it with the Timur's alex branch, but a Tested-by is appreciated. Thanks!

 tools/objtool/check.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/objtool/check.c +2 -1
index b21b12ec88d9..f23bdda737aa 100644
@@ -230,7 +230,8 @@ static bool is_rust_noreturn(const struct symbol *func)
 	       str_ends_with(func->name, "_7___rustc17rust_begin_unwind")				||
 	       strstr(func->name, "_4core9panicking13assert_failed")					||
 	       strstr(func->name, "_4core9panicking11panic_const24panic_const_")			||
-	       (strstr(func->name, "_4core5slice5index24slice_") &&
+	       (strstr(func->name, "_4core5slice5index") &&
+		strstr(func->name, "slice_") &&
 		str_ends_with(func->name, "_fail"));
 }
 

base-commit: a5806cd506af5a7c19bcd596e4708b5c464bfd21 --
2.49.0

Applied
#2 lore raw
In reply to Miguel Ojeda
Quoted 16 lines · Miguel Ojeda

Developers are indeed hitting other of the noreturn slice symbols in Nova [1], thus relax the last check in the list so that we catch all of them, i.e.

*_4core5slice5index22slice_index_order_fail *_4core5slice5index24slice_end_index_len_fail *_4core5slice5index26slice_start_index_len_fail *_4core5slice5index29slice_end_index_overflow_fail *_4core5slice5index31slice_start_index_overflow_fail

These all exist since at least Rust 1.78.0, thus backport it too.

See commit 56d680dd23c3 ("objtool/rust: list noreturn Rust functions") for more details.

Quoted 9 lines

Applied to rust-next early so that others can benefit on -next -- thanks everyone!

Fixes 56d680dd23c3 ("objtool/rust: list `noreturn` Rust functions")

Cheers,
Miguel