Re: [PATCH] objtool/rust: add one more `noreturn` Rust function
Miguel Ojeda <[email protected]>
| Newsgroups | org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <CANiq72n-=GaJyFG3sAkqUaky_Eva-A=deB05J7OoPAZNJp7b4Q@mail.gmail.com> |
On Wed, Aug 5, 2026 at 4:45 PM Miguel Ojeda <[email protected]> wrote: > > When the pointer formatting series [1] is applied and KUnit tests > are enabled, `objtool` would report an error with any of our > supported Rust versions. For instance, with Rust 1.97.1: > > rust/kernel.o: error: objtool: _R..._4core3fmt7Pointer3fmtB7_() > falls through to next function _R..._4core7convert5AsRefNtB5_4BStrE6as_ref() > > Or, with Rust 1.85.0: > > rust/kernel.o: error: objtool: _R..._4core3fmt7Pointer3fmtB7_() > falls through to next function _R..._4core3ffi5c_str4CStrENtNtBS_3fmt7Display3fmtB7_() > > This happens due to calls to the `noreturn` symbol: > > core::str::slice_error_fail > > Thus add the mangled one to the list so that `objtool` knows it is > actually `noreturn`. > > See commit 56d680dd23c3 ("objtool/rust: list `noreturn` Rust functions") > for more details. > > Cc: Josh Poimboeuf <[email protected]> > Cc: Peter Zijlstra <[email protected]> > Reported-by: Alice Ryhl <[email protected]> > Link: https://lore.kernel.org/rust-for-linux/[email protected]/ > Link: https://lore.kernel.org/rust-for-linux/[email protected]/ [1] > Signed-off-by: Miguel Ojeda <[email protected]> Applied to `rust-fixes` -- thanks! [ While the series [1] mentioned above was not applied in a way that triggered this, Gary found another case [2]: I am seeing this function causing issue on my 1.85.1 -Os build, although the error message is different this time: rust/kernel.o: warning: objtool: _R..._5range9RangeFromjEE5indexCsldbe0TGTmNx_6kernel+0x1d: stack state mismatch: cfa1=4+8 cfa2=4+16 Disassembly shows that the function call before the warning location is a call to _4core3str16slice_error_fail, and objtool thought it can return (which will end up with a unbalanced stack if it does return). Thus apply it. - Miguel ] Cc: [email protected] # Needed in 6.12.y and later (Rust is pinned in older LTSs). Cheers, Miguel