-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Port libpanic_abort and libpanic_unwind to CloudABI #47190
Conversation
CloudABI uses LLVM's libunwind for stack unwinding. There was a small bug that went by unnoticed, namely that it was not built with -fno-rtti. This caused it to (indirectly) depend on the entire C++ runtime. Now that that issue has been resolved, it is also perfectly fine to make use of this library for programming languages other than C++.
(rust_highfive has picked a reviewer for you, use r? to override) |
src/rustc/cloudabi_shim/Cargo.toml
Outdated
|
||
[lib] | ||
name = "cloudabi" | ||
path = "../../libcloudabi/rust/cloudabi.rs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make libcloudabi
a crates.io package instead of a submodule? (assuming we don't want to copy the files)
Thanks! It looks like the bindings used here are pretty slim, would it be possible to inline the cloudabi crate definitions instead of pulling in a new submodule? |
Hi Kenny, Alex, I have to confess I'm still a pretty much a newbie when it comes to Cargo, so I appreciate your input on this matter a lot. We already have the CloudABI definitions as a crate on crates.io, called
I can no longer build a simple tool that makes use of the standard libraries:
This is probably because If depending on an external crate is going to be hard, I think that Alex's idea of inlining the crate definitions makes sense. Alex: I can copy over the |
Yes unfortunately anything that std depends on can't come vanilla from crates.io. The standard library depends explicitly (via That being said though it'd be great if we could inline some specific pieces (perhaps unsafe). We already have way too many submodules as it is :( |
Thanks for confirming. Right now there are two crates in my patched Rust source tree that make use of CloudABI's definitions: If it turns out there are other places in the source tree where a dependency on the generated sources is needed, we can reconsider creating a separate crate, but for now there are ways around it. I'll update this pull request later today! |
Ideally, we should make use of CloudABI's internal proc_raise(SIGABRT) system call. POSIX abort() requires things like flushing of stdios, which may not be what we want under panic conditions. Invoking the raw CloudABI system call would have prevented that. Unfortunately, we have to make use of the "cloudabi" crate to invoke raw CloudABI system calls. This is undesired, as discussed in the pull request (rust-lang#47190).
2fe39c4
to
91611fc
Compare
Done! I think this pull request should now be good to go! |
@bors: r+ |
📌 Commit 91611fc has been approved by |
…xcrichton Port libpanic_abort and libpanic_unwind to CloudABI This change ports both the libpanic* libraries to CloudABI. The most interesting part of this pull request, however, is that it imports the CloudABI system call API into the Rust tree through a Git submodule. These will also be used by my port of libstd to CloudABI extensively, as that library obviously needs to invoke system calls to implement its primitives. I have taken the same approach as libc: `src/libcloudabi` + `src/rustc/cloudabi_shim`. If some other naming scheme is preferred, feel free to let me know! As `libcloudabi` is pretty small, maybe it makes sense to copy, instead of using a submodule?
This change ports both the libpanic* libraries to CloudABI.
The most interesting part of this pull request, however, is that it imports the CloudABI system call API into the Rust tree through a Git submodule. These will also be used by my port of libstd to CloudABI extensively, as that library obviously needs to invoke system calls to implement its primitives.
I have taken the same approach as libc:
src/libcloudabi
+src/rustc/cloudabi_shim
. If some other naming scheme is preferred, feel free to let me know! Aslibcloudabi
is pretty small, maybe it makes sense to copy, instead of using a submodule?