rust-embedded / panic-semihosting

Report panic messages to the host stderr using semihosting
Apache License 2.0
12 stars 6 forks source link

Undefined reference to `rust_begin_unwind` #3

Closed phil-opp closed 6 years ago

phil-opp commented 6 years ago

When using this crate together with the allocator example of cortex_m_quickstart I get the following linker error:

note: /home/philipp/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7em-none-eabihf/lib/libcore-ff2a90084abf53b1.rlib(core-ff2a90084abf53b1.core10-b3f31ca470b010e69733139f71d95864.rs.rcgu.o): In function `core::panicking::panic_fmt::hed27deb097b8209d':
          /checkout/src/libcore/panicking.rs:71: undefined reference to `rust_begin_unwind'

I tried to make the panic_fmt function in this crate public and no_mangle as suggested by https://github.com/rust-lang/rust/issues/38281#issuecomment-266485685, but it didn't help.

It works if I copy the panic implementation with pub and no_mangle to my main.rs.

Rust version: rustc 1.28.0-nightly (5d0631a64 2018-05-30)

japaric commented 6 years ago

This is bug rust-lang/rust#51647 caused, I think, by the new oom lang item.

japaric commented 6 years ago

I believe this has been fixed upstream.