-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Add support for the rumprun unikernel #28593
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nrc (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
@@ -53,6 +53,7 @@ pub fn opts() -> TargetOptions { | |||
exe_suffix: ".exe".to_string(), | |||
staticlib_prefix: "".to_string(), | |||
staticlib_suffix: ".lib".to_string(), | |||
no_default_libraries: false, |
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.
How come this was added?
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.
The rumprun linker wrapper uses a GCC spec file to add a path to the rumprun version of system libraries (libc, libpthread etc). If -nodefaultlibs
is specified, gcc will not use specified the path.
Maybe @mato has more insight to this, he helped me debug the issue.
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.
Oh. I completely missed that fact that this is a Windows target. This has nothing to do with rumprun, I will remove it. Sorry about that.
This slipped in from my previous patch. I ommited it in the final version, because the mvc linker doesn't include default libraries anyway.
Thanks! Pretty neat seeing Rust run on all these new platforms! Is |
Yes, x86_64-rumprun-netbsd is the official target, also used for cross-compiling C programs. There was a thread on the gcc mailing list about the rationale behind this triple: https://gcc.gnu.org/ml/gcc/2015-03/msg00350.html ( Follow up: https://gcc.gnu.org/ml/gcc/2015-04/msg00033.html ) In the future, rumprun might offer other ABIs than NetBSDs, this is why conditional compilation always checks for both, |
Exciting platform. What are your ambitions for Rust rump kernels? Any solid plans yet? |
hm, let's be wary of making What is |
On 23/09/15 00:39, Brian Anderson wrote:
I hope you do not mind me interjecting as the Cerberus for nomenclature. A rump kernel is built from [monolithic] kernel driver components with With that out the way, the question about intersection points between |
@brson I can add I can give |
I took this name from LLVM's Yeah |
I will rebase this to use |
This adds a new target property, `target_vendor`. It is to be be used as a matcher for conditional compilation. The vendor is part of the [autoconf target triple](http://llvm.org/docs/doxygen/html/classllvm_1_1Triple.html#details): `<arch><sub>-<vendor>-<os>-<env>`. `arch`, `target_os` and `target_env` are already supported by Rust. This change was suggested in PR #28593. It enables conditional compilation based on the vendor. This is needed for the rumprun target, which needs to match against both, target_os and target_vendor. The default value for `target_vendor` is "unknown", "apple" and "pc" are other common values. Matching against the `target_vendor` is introduced behind the feature gate `#![feature(cfg_target_vendor)]`. This is the first time I messed around with rustc internals. I just added the my code where I found the existing `target_*` variables, hopefully I haven't missed anything. Please review with care. :) r? @alexcrichton
For most parts, rumprun currently looks like NetBSD, as they share the same libc and drivers. However, being a unikernel, rumprun does not support process management, signals or virtual memory, so related functions might fail at runtime. Stack guards are disabled exactly for this reason. Code for rumprun is always cross-compiled, it uses always static linking and needs a custom linker.
Rebased to use |
This adds a new target, `x86_64-rumprun-netbsd`, and related changes to `std`. Rumprun is a unikernel platform that provides a POSIX-y interface. For the most part, rumprun uses NetBSD's libc and drivers, therefore `target_os` is `netbsd`. However, being a unikernel, rumprun does not support process management, signals or virtual memory, so related functions might fail at runtime. For this reason, stack guards are disabled in `std`. To support conditional compilation, `target_env` is set to `rumprun`. Maybe `target_vendor` would be technically more fitting, but it doesn't seem to be worth the hassle. Code for rumprun is always cross-compiled, it uses always static linking and needs a custom linker. The target makes use of the newly introduced `no_default_libs` flag, as the rumprun linker will otherwise not use the correct search path.
This adds a new target,
x86_64-rumprun-netbsd
, and related changes tostd
.Rumprun is a unikernel platform that provides a POSIX-y interface. For the most part, rumprun uses NetBSD's libc and drivers, therefore
target_os
isnetbsd
. However, being a unikernel, rumprun does not support process management, signals or virtual memory, so related functions might fail at runtime. For this reason, stack guards are disabled instd
.To support conditional compilation,
target_env
is set torumprun
. Maybetarget_vendor
would be technically more fitting, but it doesn't seem to be worth the hassle.Code for rumprun is always cross-compiled, it uses always static linking and needs a custom linker. The target makes use of the newly introduced
no_default_libs
flag, as the rumprun linker will otherwise not use the correct search path.