Skip to content
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

Issue building 'Setup Rust' #261

Closed
RyanPSullivan opened this issue Dec 14, 2016 · 5 comments
Closed

Issue building 'Setup Rust' #261

RyanPSullivan opened this issue Dec 14, 2016 · 5 comments
Assignees

Comments

@RyanPSullivan
Copy link

Hey Im experiencing the following error when trying to build at the end of the setup rust tutorial

target/x86_64-unknown-linux-gnu/debug/librust_os.a(core-1357b93f.0.o): In function core::panicking::panic_fmt': /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcore/panicking.rs:69: undefined reference to rust_begin_unwind'

@RyanPSullivan
Copy link
Author

Ah I've seen that you already raised the issue on the rust-lang page rust-lang/rust#38281 and they posted a solution that seems to work,

@phil-opp
Copy link
Owner

Thanks for reporting!

Yeah, this is a rust problem that was introduced in the 2016-12-05 nightly: rust-lang/rust#38281. It seems like the panic_fmt lang item doesn't export the rust_begin_unwind symbol anymore.

I know of two workarounds:

  1. Use the 2016-12-04 nightly until the issue is resolved.
  2. Define a exported rust_begin_unwind symbol in the assembly sources. However, with this approach rust will jump to the assembly symbol on panic, which isn't desirable.

@phil-opp phil-opp self-assigned this Dec 14, 2016
@adeadman
Copy link

I left a comment on the blog post DIsqus, but you don't need to export that symbol in the sources. Just add #[no_mangle] to the panic_fmt entry like so:
#[lang = "panic_fmt"] #[no_mangle] pub extern fn panic_fmt() -> ! {loop{}}

This compiles and runs without error.

@phil-opp
Copy link
Owner

Thanks a lot for the hint! It works without problems.

I added no_mangle to all panic_fmt declarations in #262.

@phil-opp
Copy link
Owner

phil-opp commented Jan 4, 2017

It seems like pub + no_mangle is the official solution now.

I've updated the source code and all posts and cherry-picked the changes to all tags. So I think this issue is resolved.

@phil-opp phil-opp closed this as completed Jan 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants