- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
          build-std compatible profile(code coverage) support
          #101392
        
          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
Conversation
| r? @jyn514 (rust-highfive has picked a reviewer for you, use r? to override) | 
255575f    to
    0a4ee4d      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
b70858b    to
    a2a1455      
    Compare
  
    | Wouldn't this make profiling for targets other than the host impossible with -Zbuild-std? | 
| 
 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. | 
| 
 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
    1beefdd      
    Compare
  
    | Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any  Examples of  
 | 
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.
| 
 #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  | 
| 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? | 
| 
 This PR make profiler provided in the same way as sanitizers(prebuilt *.a). They are all  Ref: #65241 | 
| 
 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? | 
| 
 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  | 
| 
 As mentioned earlier in this thread. It is already possible, but requires target to be installed. | 
| That doesn't help anything for tier3 and external targets as they can't be installed. | 
| 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? | 
| 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  | 
| ☔ The latest upstream changes (presumably #101833) made this pull request unmergeable. Please resolve the merge conflicts. | 
6663815    to
    2e88784      
    Compare
  
    | ☔ The latest upstream changes (presumably #102975) made this pull request unmergeable. Please resolve the merge conflicts. | 
2e88784    to
    98e9732      
    Compare
  
    98e9732    to
    081e102      
    Compare
  
    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.
Is this attribute still used anywhere? Can we remove it altogether?
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.
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.
| ☔ The latest upstream changes (presumably #103345) made this pull request unmergeable. Please resolve the merge conflicts. | 
081e102    to
    04963ab      
    Compare
  
    | ☔ The latest upstream changes (presumably #103797) made this pull request unmergeable. Please resolve the merge conflicts. | 
| @ldm0 | 
| @ldm0 | 
| 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
fixes rust-lang/wg-cargo-std-aware#63
fixes rust-lang/wg-cargo-std-aware#68
cc @ehuss @bjorn3 @jyn514