add a dist builder to build rust-std components for the THUMB targets#49563
add a dist builder to build rust-std components for the THUMB targets#49563bors merged 7 commits intorust-lang:masterfrom
Conversation
the rust-std component only contains the core and compiler-builtins (+c +mem) crates cc rust-lang#49382
@alexcrichton I'd like to build other no-std crates into the rust-std component. What do you think is the best approach to take here? Perhaps make a fake std crate that depends on all the no-std crates we want to put in the component? |
wouldn't it be easier at that point to undo most of this PR and strip down libstd with cfgs instead? We can also use a cfg to insert an attribute making the use of std unstable on the embedded target |
|
@oli-obk that might work but I'm not sure if
That being said I'll give these a try on a smaller Cargo project. |
[target.'cfg(all(target_arch = "arm", target_os = "none"))'.dependencies.cb] # THUMB
features = ["mem"]
path = "../cb"
[target.'cfg(not(all(target_arch = "arm", target_os = "none")))'.dependencies.cb] # not THUMB
path = "../cb"seems to do the right thing dependency and feature selection wise, but I have run into a problem trying to make libstd empty: I tried to use I could add a bunch of |
src/bootstrap/sanity.rs
Outdated
| panic!("the iOS target is only supported on macOS"); | ||
| } | ||
|
|
||
| if target.starts_with("thumbv") { |
There was a problem hiding this comment.
How about contains("-none-") because that's the part that makes them no_std?
|
Nice! The rustbuild changes here look good to me, but can this be folded into one of the existing |
|
@alexcrichton done. Any thoughts on how to extend this to build alloc and other no-std crates? |
|
Hm right now there's a |
the goal is to build, in a single Cargo invocation, several no-std crates that we want to put in the rust-std component of no-std targets. The nostd crate builds these crates: - core - compiler-builtin (with the "c" and "mem" features enabled) - alloc - std_unicode
It would have to be an array because we want to build core, compiler-builtins (+c +mem), alloc and I have tweaked the implementation: I have created a "nostd" crate (can't be named "std" because that already exists in the workspace) Let me know what you think of this implementation. I personally think it's easier to maintain a Cargo.toml than maintain some custom syntax in config.toml. The downside is that the rust-std component will contain an empty libnostd.rlib -- using |
|
@japaric oh if we're unconditionally building |
This reverts commit 14768f9.
|
@alexcrichton changed to just use |
|
@bors: r+ |
|
📌 Commit b1015f5 has been approved by |
add a dist builder to build rust-std components for the THUMB targets the rust-std component only contains the core and compiler-builtins (+c +mem) crates cc rust-lang#49382 - I'm not entirely sure if this PR alone will produce rust-std components installable by rustup or if something else needs to be changed - I could have done the THUMB builds in an existing builder / image; I wasn't sure if that was a good idea so I added a new image - I could build other crates like alloc into the rust-std component but, AFAICT, that would require calling Cargo a second time (one for alloc and one for compiler-builtins), or have alloc depend on compiler-builtins (rust-lang#49503 will perform that change) *and* have alloc resurface the "c" and "mem" Cargo features. r? @alexcrichton
add a dist builder to build rust-std components for the THUMB targets the rust-std component only contains the core and compiler-builtins (+c +mem) crates cc rust-lang#49382 - I'm not entirely sure if this PR alone will produce rust-std components installable by rustup or if something else needs to be changed - I could have done the THUMB builds in an existing builder / image; I wasn't sure if that was a good idea so I added a new image - I could build other crates like alloc into the rust-std component but, AFAICT, that would require calling Cargo a second time (one for alloc and one for compiler-builtins), or have alloc depend on compiler-builtins (rust-lang#49503 will perform that change) *and* have alloc resurface the "c" and "mem" Cargo features. r? @alexcrichton
Rollup of 9 pull requests Successful merges: - #48658 (Add a generic CAS loop to std::sync::Atomic*) - #49253 (Take the original extra-filename passed to a crate into account when resolving it as a dependency) - #49345 (RFC 2008: Finishing Touches) - #49432 (Flush executables to disk after linkage) - #49496 (Add more vec![... ; n] optimizations) - #49563 (add a dist builder to build rust-std components for the THUMB targets) - #49654 (Host compiler documentation: Include private items) - #49667 (Add more features to rust_2018_preview) - #49674 (ci: Remove x86_64-gnu-incremental builder) Failed merges:
|
@alexcrichton the latest nightly includes this change but there's no thumbv7m-none-eabi under |
|
The rust-std components have been uploaded (e.g. https://static.rust-lang.org/dist/2018-04-06/rust-std-nightly-thumbv7m-none-eabi.tar.xz) but the rustup manifest doesn't contain their URLs. |
…richton add THUMB targets to rustup manifest as instructed in rust-lang#49563 (comment) r? @alexcrichton
…richton add THUMB targets to rustup manifest as instructed in rust-lang#49563 (comment) r? @alexcrichton
the rust-std component only contains the core and compiler-builtins (+c +mem) crates
cc #49382
compiler_builtinscrate whenever thecorecrate is injected #49503 will perform that change) and have alloc resurface the "c" and "mem" Cargo features.r? @alexcrichton