[PGO][AIX] Improve dummy var retention and allow -bcdtors:csect linking.
authorWael Yehia <wyehia@ca.ibm.com>
Thu, 20 Oct 2022 16:07:35 +0000 (16:07 +0000)
committerWael Yehia <wyehia@ca.ibm.com>
Fri, 21 Oct 2022 16:32:42 +0000 (16:32 +0000)
commit461a1836d3d77371bb6271fefd645897997a22b8
tree6f7ec5a9bbee3219a6ca885c46dd0c33456196c2
parent4fd2b49115c88e6210e8c82a841bf44ad0159ddb
[PGO][AIX] Improve dummy var retention and allow -bcdtors:csect linking.

1) Use a static array of pointer to retain the dummy vars.
2) Associate liveness of the array with that of the runtime hook variable
   __llvm_profile_runtime.
3) Perform the runtime initialization through the runtime hook variable.
4) Preserve the runtime hook variable using the -u linker flag.

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D136192
clang/lib/Driver/ToolChains/AIX.cpp
clang/lib/Driver/ToolChains/AIX.h
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
compiler-rt/lib/profile/InstrProfilingRuntime.cpp
compiler-rt/test/profile/AIX/lit.local.cfg.py [new file with mode: 0644]
compiler-rt/test/profile/AIX/shared-bexpall-pgo.c [new file with mode: 0644]
llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
llvm/test/Instrumentation/InstrProfiling/no-counters.ll
llvm/test/Instrumentation/InstrProfiling/profiling.ll