[compiler-rt] [llvm] [clang] [Profile] Refactor profile correlation. (PR #70856)

Zequan Wu via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 2 13:29:16 PDT 2023


ZequanWu wrote:

> I'm a bit concerned about the use of hasCorrelation. We require the runtime to check the flag and omit the data and names section if set which introduces a potential issue: since we emit the version in every TU and u se COMDAT to deduplicate them, but that means that if you link together TUs compiled with and without -debug-info-correlate/-profile-correlate= (that is having different flags), you would end up with different results depending on which section was selected by the linker. This may not be an issue if you always compile all code yourself using the same set of flags, but might be an issue when you combine libraries coming from different sources.

I understand your concern. I think that's the limitation of these modes. You need to either compile all code with `-debug-info-correlate`/`-profile-correlate=` consistently or not. So, these modes are not suitable for projects which link with libraries compiled without the flags.

> 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?

https://github.com/llvm/llvm-project/pull/70856


More information about the cfe-commits mailing list