Uh oh!
There was an error while loading. Please reload this page.
build-std compatible profile(code coverage) support - #101392
Conversation
rust-highfive
commented
Sep 3, 2022
r? @jyn514 (rust-highfive has picked a reviewer for you, use r? to override) |
255575f to
0a4ee4dCompare
This comment has been minimized.
This comment has been minimized.
b70858b to
a2a1455CompareUh oh!
There was an error while loading. Please reload this page.
bjorn3
commented
Sep 4, 2022
Wouldn't this make profiling for targets other than the host impossible with -Zbuild-std? |
ldm0
commented
Sep 4, 2022
Do you mean cross compiling with profiling enabled? I think that's possible since profiler runtime is provided in the target lib in sysroot. This PR makes profiler-runtime to be provided in the same way as santizer-runtimes (#65241 could be referenced). Therefore, profilers can be used in almost the same way as sanitizers. |
bjorn3
commented
Sep 4, 2022
Yes
What if you want to use |
Currenly without the prebuilt static lib, it's not possible. We can copy the source code with rust-src though. But it would be awkward to compile a cpp based compiler-rt when building std, unnecessary dependencies like cmake or cc will be required. |
7a65dce to
1beefddComparerustbot
commented
Sep 4, 2022
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
Uh oh!
There was an error while loading. Please reload this page.
ldm0
commented
Sep 7, 2022
#101009 is expected to be a harmless&simple improvement which I expect to merge before this PR. But If this PR is merged before #101009 , #101009 is useless since |
ehuss
commented
Sep 10, 2022
I'm a bit confused on how this solves the linked issues. It looks like this depends on having profiler_builtins in the sysroot, which I mentioned in #101009 (comment) is probably not the direction I would want to go. Am I misreading how this works? |
ldm0
commented
Sep 10, 2022
This PR make profiler provided in the same way as sanitizers(prebuilt *.a). They are all Ref: #65241 |
bjorn3
commented
Sep 10, 2022
Sanitizer support was introduced several years before -Zbuild-std. If -Zbuild-std support had been introduced first, it would likely not have been considered acceptable to use precompiled static libs for sanitizers.
We already require a C compiler for building compiler-builtins on many targets. Is cmake that much worse? Would it be possible to rewrite the build logic for the parts of compiler-rt that we need in rust instead if this is the case? |
ldm0
commented
Sep 10, 2022
Profiler support was also introduced several years before
Add unnecessary CMake+Cpp dependencies in rust project is practically bad (various compilation issues will occurs) e.g. tokio-rs/prost#657
Summary of my concerns:
Our company project is relying on |
tmiasko
commented
Sep 10, 2022
As mentioned earlier in this thread. It is already possible, but requires target to be installed. |
bjorn3
commented
Sep 10, 2022
That doesn't help anything for tier3 and external targets as they can't be installed. |
tmiasko
commented
Sep 11, 2022
I see, so you are interested in use-cases where those components have to be built because they are otherwise unavailable. I would expect that implementing support for such use-cases would be up to the people interested in them. I don't think we should block -Zbuild-std compatible implementation for that reason. Unless you have concrete proposal for alternative solution? |
bjorn3
commented
Sep 11, 2022
Maybe we could have a precompiled profiler runtime in the sysroot for tier 1 and tier 2 targets, but build it from scratch using cmake if the sysroot version is not available? This could be implemented by making the profiler_builtins crate |
bors
commented
Sep 29, 2022
☔ The latest upstream changes (presumably #101833) made this pull request unmergeable. Please resolve the merge conflicts. |
6663815 to
2e88784Comparebors
commented
Oct 12, 2022
☔ The latest upstream changes (presumably #102975) made this pull request unmergeable. Please resolve the merge conflicts. |
2e88784 to
98e9732Compare98e9732 to
081e102CompareThere was a problem hiding this comment.
Is this attribute still used anywhere? Can we remove it altogether?
There was a problem hiding this comment.
There is an unstable option "-Zprofiler-runtime=<crate_name>" for users to inject their custom profiler runtime. The profiler_runtime attribute is the profiler-runtime-crate marker. So if the attribute is removed, -Zprofiler-runtime will be useless.
bors
commented
Oct 23, 2022
☔ The latest upstream changes (presumably #103345) made this pull request unmergeable. Please resolve the merge conflicts. |
081e102 to
04963abComparebors
commented
Oct 31, 2022
☔ The latest upstream changes (presumably #103797) made this pull request unmergeable. Please resolve the merge conflicts. |
JohnCSimon
commented
Jan 1, 2023
@ldm0 |
JohnCSimon
commented
Jan 29, 2023
@ldm0 |
Dylan-DPC
commented
May 15, 2023
Closing this as inactive. Feel free to reöpen this pr or create a new pr if you get the time to work on this. Thanks |
profiler_builtinscrate (user-provided profiler runtime through-Zprofiler-runtimeis still injected)compiler-rt/profilein bootstrap and copy it to sysroot(just like sanitizers)fixes#79401
fixesrust-lang/wg-cargo-std-aware#63
fixesrust-lang/wg-cargo-std-aware#68
cc @ehuss@bjorn3@jyn514