Skip to content

Commit dbdf2a7

Browse files
ojedaPeter Zijlstra
authored andcommitted
objtool/rust: add one more noreturn Rust function
Between Rust 1.79 and 1.86, under `CONFIG_RUST_KERNEL_DOCTESTS=y`, `objtool` may report: rust/doctests_kernel_generated.o: warning: objtool: rust_doctest_kernel_alloc_kbox_rs_13() falls through to next function rust_doctest_kernel_alloc_kvec_rs_0() (as well as in rust_doctest_kernel_alloc_kvec_rs_0) due to calls to the `noreturn` symbol: core::option::expect_failed from code added in commits 779db37 ("rust: alloc: kvec: implement AsPageIter for VVec") and 6716184 ("rust: alloc: kbox: implement AsPageIter for VBox"). Thus add the mangled one to the list so that `objtool` knows it is actually `noreturn`. This can be reproduced as well in other versions by tweaking the code, such as the latest stable Rust (1.90.0). Stable does not have code that triggers this, but it could have it in the future. Downstream forks could too. Thus tag it for backport. See commit 56d680d ("objtool/rust: list `noreturn` Rust functions") for more details. Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Cc: [email protected] # Needed in 6.12.y and later. Link: https://patch.msgid.link/[email protected]
1 parent 211ddde commit dbdf2a7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/objtool/check.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ static bool is_rust_noreturn(const struct symbol *func)
217217
* these come from the Rust standard library).
218218
*/
219219
return str_ends_with(func->name, "_4core5sliceSp15copy_from_slice17len_mismatch_fail") ||
220+
str_ends_with(func->name, "_4core6option13expect_failed") ||
220221
str_ends_with(func->name, "_4core6option13unwrap_failed") ||
221222
str_ends_with(func->name, "_4core6result13unwrap_failed") ||
222223
str_ends_with(func->name, "_4core9panicking5panic") ||

0 commit comments

Comments
 (0)