[AIX] Using LLVM 17 to build compiler-rt on AIX creates a bad profile library
InstrProfilingPlatformAIX.c.o has zero-size __llvm_prf_cnts, __llvm_prf_data, __llvm_prf_names, and __llvm_prf_vnds symbols meant as a fallback for AIX linking when the "user" .os being linked are were not compiled with profiling enabled.
IIUC, to ensure that these symbols are all kept consistently, in the same order, in the general case (e.g., when they are generated by the profiling instrumentation), the compiler automatically generates special relocations that cause __llvm_prf_cnts to refer to the other symbols. Unfortunately, when __llvm_prf_counts is zero-sized, the relocations as encoded in the XCOFF binary file format do not have a unique referring csect symbol (and this is a cause for linking issues).
Since the motivation for generating these relocations do not apply in zero-size cases, a solution is to avoid generating them for such cases.
A possible alternative solution would be to change the compiler and various OS toolchain components to allocate a unique address to zero-sized csect symbols that have such relocations; however, OS toolchain refreshes only happen infrequently.
https://github.com/llvm/llvm-project/pull/66805 posted
/cherry-pick da55b1b52fbce80093eee8dd4185df4861a44ba5
/branch llvm/llvm-project-release-prs/issue65661
/pull-request llvm/llvm-project-release-prs#711