llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[AIX] Using LLVM 17 to build compiler-rt on AIX creates a bad profile library

Open w2yehia opened this issue 3 years ago • 5 comments

w2yehia avatar Sep 07 '23 19:09 w2yehia

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.

hubert-reinterpretcast avatar Sep 07 '23 20:09 hubert-reinterpretcast

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

w2yehia avatar Sep 19 '23 19:09 w2yehia

/cherry-pick da55b1b52fbce80093eee8dd4185df4861a44ba5

w2yehia avatar Sep 28 '23 05:09 w2yehia

/branch llvm/llvm-project-release-prs/issue65661

llvmbot avatar Sep 28 '23 05:09 llvmbot

/pull-request llvm/llvm-project-release-prs#711

llvmbot avatar Sep 28 '23 06:09 llvmbot