[llvm] Do not generate the special .ref for zero-sized sections (PR #66805)

Wael Yehia via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 16:24:01 PDT 2023


w2yehia wrote:

> Is there any downside to loosing the refs in this case? (if there is maybe its better to pad the sections to make everything unambiguous?)

The refs were added specifically for PGO instrumentation sections (counters, data, names, value profiling nodes), and PGO instrumentation will not create zero-length objects. The case where we have zero-length objects sitting in PGO sections is the dummy zero-length variables manually added to the PGO runtime [here](https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/profile/InstrProfilingPlatformAIX.c#L188). Not emitting the refs when compiling the PGO runtime source file will not impact functionality (as Hubert pointed out, offline, the `__llvm_profile_keep` array retains the dummy variables).

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


More information about the llvm-commits mailing list