-
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
Minor improvements to -Zprofile #71283
Conversation
r? @davidtwco (rust_highfive has picked a reviewer for you, use r? to override) |
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.
LGTM, and good catch!
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.
r=me when CI passes
@bors r=davidtwco |
📌 Commit 9f23b2d has been approved by |
Minor improvements to -Zprofile - `-Zprofile` is broken with codegen units because GCOV assumes that each source file corresponds to one object file. This PR makes `-Zprofile` automatically set codegen units to 1 and gives an error if `-Ccodegen-units=X` is specified on the command line (with `X != 1`). - The `profiler_builtins` crate is not suitable for `no_std` applications since it contains C code that depends on libc. In such cases a custom implementation of the LLVM gcov API (`llvm_gcov_init`, `llvm_gcda_*`) is needed. This PR adds `-Zno-profiler-runtime` flag which inhibits automatic injection of the `profiler_builtins` crate. cc @whitequark who implemented the original `-Zprofile` support
Minor improvements to -Zprofile - `-Zprofile` is broken with codegen units because GCOV assumes that each source file corresponds to one object file. This PR makes `-Zprofile` automatically set codegen units to 1 and gives an error if `-Ccodegen-units=X` is specified on the command line (with `X != 1`). - The `profiler_builtins` crate is not suitable for `no_std` applications since it contains C code that depends on libc. In such cases a custom implementation of the LLVM gcov API (`llvm_gcov_init`, `llvm_gcda_*`) is needed. This PR adds `-Zno-profiler-runtime` flag which inhibits automatic injection of the `profiler_builtins` crate. cc @whitequark who implemented the original `-Zprofile` support
Rollup of 5 pull requests Successful merges: - rust-lang#71271 (Move `MapInPlace` to rustc_data_structures) - rust-lang#71276 (miri-unleashed: test that we detect heap allocations) - rust-lang#71283 (Minor improvements to -Zprofile) - rust-lang#71287 (Explain why we shouldn't add inline attr to into_vec) - rust-lang#71303 (remove build warnings) Failed merges: r? @ghost
Just published |
@Amanieu Excellent work! |
… r=cramertj Ignore -Zprofile when building compiler_builtins rust-lang#70846 made the `compiler_builtins` crate ignore the default codegen-units setting and instead always split each function into a different codegen unit. This unfortunately breaks `-Zprofile` which requires a single codegen unit per crate (see rust-lang#71283). You can notice this when building with `cargo -Zbuild-std` and `RUSTFLAGS` containing `-Zprofile`. This PR works around this issue by just ignoring `-Zprofile` for the `compiler-builtins` crate.
… r=cramertj Ignore -Zprofile when building compiler_builtins rust-lang#70846 made the `compiler_builtins` crate ignore the default codegen-units setting and instead always split each function into a different codegen unit. This unfortunately breaks `-Zprofile` which requires a single codegen unit per crate (see rust-lang#71283). You can notice this when building with `cargo -Zbuild-std` and `RUSTFLAGS` containing `-Zprofile`. This PR works around this issue by just ignoring `-Zprofile` for the `compiler-builtins` crate.
-Zprofile
is broken with codegen units because GCOV assumes that each source file corresponds to one object file. This PR makes-Zprofile
automatically set codegen units to 1 and gives an error if-Ccodegen-units=X
is specified on the command line (withX != 1
).profiler_builtins
crate is not suitable forno_std
applications since it contains C code that depends on libc. In such cases a custom implementation of the LLVM gcov API (llvm_gcov_init
,llvm_gcda_*
) is needed. This PR adds-Zno-profiler-runtime
flag which inhibits automatic injection of theprofiler_builtins
crate.cc @whitequark who implemented the original
-Zprofile
support