[llvm] Avoid merging instrumentation profiler globals (PR #172835)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 18 10:25:08 PST 2025


eleviant wrote:

> If the issue is that GlobalMerge doesn't respect comdat semantics, should we add a check for that, instead of special-casing profiling globals?

I'm not sure that moving a section out of comdat is a problem in all cases. In this particular case nothing bad happens when --gc-sections is not used. Usage of --gc-sections cause a problem only because profiler runtime needs counter metadata to collect profiles. I'm afraid that preserving comdats in GlobalMerge would break too many things.

Another way of fixing might be preserving profiler sections in linker, however I don't get why would anyone want to merge profile counters?


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


More information about the llvm-commits mailing list