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

Add support for -Cembed-bitcode=no #8066

Merged
merged 1 commit into from
Apr 3, 2020

Conversation

alexcrichton
Copy link
Member

This commit is the Cargo half of support necessary for
rust-lang/rust#70458. Today the compiler emits embedded bytecode in
rlibs by default, but compresses it. This is both extraneous disk space
and wasted build time for almost all builds, so the PR in question there
is changing rustc to have a -Cembed-bitcode flag which, when enabled,
places the bitcode in the object file rather than an auxiliary file (no
extra compression), but also enables -Cembed-bitcode=no to disable
bitcode emission entirely.

This Cargo support changes Cargo to pass -Cembed-bitcode=no for almost
all compilations. Cargo will keep lto = true and such working by not
passing this flag (and thus allowing bitcode to get embedded), but by
default cargo build and cargo build --release will no longer have
any bitcode in rlibs which should result in speedier builds!

Most of the changes here were around the test suite and various
assertions about the rustc command lines we spit out. One test was
hard-disabled until we can get -Cembed-bitcode=no into nightly, and
then we can make it a nightly-only test. The test will then be stable
again once -Cembed-bitcode=no hits stable.

Note that this is intended to land before the upstream -Cembed-bitcode
change. The thinking is that we'll land everything in rust-lang/rust all
at once so there's no build time regressions for anyone. If we were to
land the -Cembed-bitcode PR first then there would be a build time
regression until we land Cargo changes because rustc would be emitting
uncompressed bitcode by default and Cargo wouldn't be turning it off.

@rust-highfive
Copy link

r? @ehuss

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 1, 2020
@@ -41,6 +41,8 @@ pub struct TargetInfo {
pub rustflags: Vec<String>,
/// Extra flags to pass to `rustdoc`, see `env_args`.
pub rustdocflags: Vec<String>,
/// REmove this when it hits stable (1.44)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: extraneous upper-case 'E'.

This commit is the Cargo half of support necessary for
rust-lang/rust#70458. Today the compiler emits embedded bytecode in
rlibs by default, but compresses it. This is both extraneous disk space
and wasted build time for almost all builds, so the PR in question there
is changing rustc to have a `-Cembed-bitcode` flag which, when enabled,
places the bitcode in the object file rather than an auxiliary file (no
extra compression), but also enables `-Cembed-bitcode=no` to disable
bitcode emission entirely.

This Cargo support changes Cargo to pass `-Cembed-bitcode=no` for almost
all compilations. Cargo will keep `lto = true` and such working by not
passing this flag (and thus allowing bitcode to get embedded), but by
default `cargo build` and `cargo build --release` will no longer have
any bitcode in rlibs which should result in speedier builds!

Most of the changes here were around the test suite and various
assertions about the `rustc` command lines we spit out. One test was
hard-disabled until we can get `-Cembed-bitcode=no` into nightly, and
then we can make it a nightly-only test. The test will then be stable
again once `-Cembed-bitcode=no` hits stable.

Note that this is intended to land before the upstream `-Cembed-bitcode`
change. The thinking is that we'll land everything in rust-lang/rust all
at once so there's no build time regressions for anyone. If we were to
land the `-Cembed-bitcode` PR first then there would be a build time
regression until we land Cargo changes because rustc would be emitting
uncompressed bitcode by default and Cargo wouldn't be turning it off.
@ehuss
Copy link
Contributor

ehuss commented Apr 3, 2020

@bors r+

It would be nice to have a better way to check compiler flags.

@bors
Copy link
Contributor

bors commented Apr 3, 2020

📌 Commit bac300b has been approved by ehuss

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 3, 2020
@bors
Copy link
Contributor

bors commented Apr 3, 2020

⌛ Testing commit bac300b with merge 805462e...

@bors
Copy link
Contributor

bors commented Apr 3, 2020

☀️ Test successful - checks-azure
Approved by: ehuss
Pushing 805462e to master...

@bors bors merged commit 805462e into rust-lang:master Apr 3, 2020
@alexcrichton alexcrichton deleted the embed-bitcode-no branch April 3, 2020 16:45
Centril added a commit to Centril/rust that referenced this pull request Apr 9, 2020
Update cargo

4 commits in 6e07d2dfb7fc87b1c9489de41da4dafa239daf03..390e8f245ef2cd7ac698b8a76abf029f9abcab0d
2020-03-31 03:22:39 +0000 to 2020-04-07 17:46:45 +0000
- Compatibility for rust-lang#69926 (rust-lang/cargo#8080)
- Add note about converting triple case in environment variables (rust-lang/cargo#8079)
- Add support for `-Cembed-bitcode=no` (rust-lang/cargo#8066)
- Add triagebot configuration (rust-lang/cargo#8059)
Centril added a commit to Centril/rust that referenced this pull request Apr 9, 2020
Update cargo

4 commits in 6e07d2dfb7fc87b1c9489de41da4dafa239daf03..390e8f245ef2cd7ac698b8a76abf029f9abcab0d
2020-03-31 03:22:39 +0000 to 2020-04-07 17:46:45 +0000
- Compatibility for rust-lang#69926 (rust-lang/cargo#8080)
- Add note about converting triple case in environment variables (rust-lang/cargo#8079)
- Add support for `-Cembed-bitcode=no` (rust-lang/cargo#8066)
- Add triagebot configuration (rust-lang/cargo#8059)
@ehuss ehuss added this to the 1.44.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants