rust-lang / wg-cargo-std-aware

Repo for working on "std aware cargo"
133 stars 8 forks source link

Fixup some crate flags. #28

Open ehuss opened 4 years ago

ehuss commented 4 years ago

There are some crates that require special compiler flags. The current implementation does not do a good job of passing these flags. It would be ideal if these could be pushed towards some kind of config somewhere. Currently they are scattered in the bootstrap code.

Some that I can think of is:

alexcrichton commented 4 years ago

One issue here is that when considering stabilization of -Z build-std in one form or another this'll be adding an implicit contract with upstream rust-lang/rust about building libstd and the fanciness we can control flags with. That's just always a thing we'd have to deal with though.

To actually deal with the specific issues, though:

I think all in all I'd sort of see this issue as we "we should delete bin/rustc.rs", or at least to the best extent that we can.

alexcrichton commented 4 years ago

As an update on this, https://github.com/rust-lang/rust/pull/64316 is an attempt to move away from src/bootstrap/bin/rustc.rs as much as possible, partly to prepare for -Zbuild-std where Cargo isn't always passing loads of fancy flags to libstd.

The current shim as of now is largely just a glorified wrapper for dealing with bootstrapping and a few miscellaneous flags, plus the exact two use cases mentioned in the description of this issue. All other flags are passed in one of two locations:

I've also been trying to figure out what to do about compiler-builtins, but the only reason it's compiled with panic=abort and debug-assertions off was to fix linking issues. I can't for the life of me actually reproduce these linking issues, and I'm not entirely certain as to why. It may be a case though where we can largely sweep it under the rug until it actually comes up. In any case it should be transparently handled so fixing it wouldn't exactly constitute a breaking change.

tmiasko commented 4 years ago

The rust-lang/compiler-builtins#347 is one example of linking issues encountered when build-std is combined with fat LTO on a profile with debug assertions.