petrhosek wrote:

> > What I think would be a better design is to just omit the respective 
> > sections altogether when -debug-info-correlate/-profile-correlate= is 
> > enabled.
> 
> I don't understand how this solves the problem you described above. Can you 
> elaborate a bit more? We still need to decide if we need to omit data and 
> names sections at runtime right?

If you omit the data and names sections from the object files, then 
`__llvm_profile_end_data() - __llvm_profile_begin_data()` and 
`__llvm_profile_end_names() - __llvm_profile_begin_names()` are both `0` and 
there's no need for [special casing this in the 
runtime](https://github.com/llvm/llvm-project/blob/24b11ba24da3e65f718391ccc85d4d22a081e893/compiler-rt/lib/profile/InstrProfilingBuffer.c#L59).
 When linking together objects complied with different flags, sizes of those 
sections would correspond only to object files compiled without correlation. 
For example, if linking together `a.o` compiled with debug info correlation and 
`b.o` compiled without, the profile would only contain data and names from 
`b.o`.

This approach would require slightly more complex logic in the correlator. 
Currently, we either read the data and names from the profile or from DWARF 
(depending on the flag), there's no in-between state. With the approach I'm 
proposing, we would need to combine data from different sources: read the data 
and names in the profile and combine them with the data and names in the DWARF 
and/or the unstripped file.

https://github.com/llvm/llvm-project/pull/70856
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to