-
Notifications
You must be signed in to change notification settings - Fork 13.3k
undefined symbol: __rustc::rust_begin_unwind when using panic="abort" #139923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The regression range coincides with #127173. Would you be able to check if that is indeed the regressing commit using https://github.com/rust-lang/cargo-bisect-rustc? Does it work with LTO disabled? |
Actually, I think I know the problem already. Some of the examples use |
Yes, removing |
Is this to be considered an error or at least a warning? I would could try adding a warning to the compiler or clippy, but I am n to sure if this is something that the project wants. |
I agree we should make it an error. Likely will need to be a future incompat warning first. |
Could you point me in the right direction on where to read about how to add this? I think I have a good idea where to add it and how to detect it (probably in |
I think the most robust way to handle this would be to in the
codegen_fn_attrs.flags contains CodegenFnAttrFlags::NO_MANGLE and emit an error if it contains CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL (that one is unstable, so no need for a future incompat warning).
|
Thank you, I'll try to implement it. The reason we used #[no_mangle]
fn actual_panic_handler(p: &PanicInfo) -> ! {
/* handle the panic */
}
#[panic_handler]
pub unsafe fn panic(p: &PanicInfo) -> ! {
actual_panic_handler(p);
} |
You can use |
I opened an PR with for this #140203 , any feedback would be greatly appreciated. |
Starting with rust nightly from mid march, we get an
undefined symbol: __rustc::rust_begin_unwind
error when compilingno_std
withpanic="abort"
targets. This happens for al leastx86_64
,armv6m
andarmv7m
targets.Example
We am trying to compile Tock's raspberry_pi_pico.
This is our
rust-toolchain.toml
file:This is the profile setup in
Cargo.toml
:We expected it to successfully compile.
Instead, we get the undefined symbol error. It seems like the linker is ignoring the
panic="abort"
setting.rustc --version --verbose
:The full error that I get is:
Working version
Everything compile fine when using rust nightly up to (including) this version:
rust-toolchain.toml
:rustc --version --versbose
:We get the error mentioned above if we try to compile with newer rust nightly versions.
The text was updated successfully, but these errors were encountered: