This patch switches the PGO implementation on AIX from using the runtime registration-based section tracking to the __start_SECNAME/__stop_SECNAME based.
In order to enable the recognition of __start_SECNAME/__stop_SECNAME symbols in the AIX linker, the -bdbg:namedsects:ss needs to be used.
Details
- Reviewers
daltenty hubert.reinterpretcast jsji MaskRay davidxl - Group Reviewers
Restricted Project - Commits
- rG2407c13aa4a4: [AIX][PGO] Enable linux style PGO on AIX
Diff Detail
Event Timeline
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c | ||
---|---|---|
11 | What is the major reason that we want to share the file with Linux? Would it be better to have AIX on its own file? |
Forking InstrProfilingPlatformLinux.c looks good to me. The misnomer *Linux.c file works with a number of ELF operating systems. Developers know that one feature working on one OS will likely work on others.
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c | ||
---|---|---|
11 | The main reason is the non-trivial amount of code duplication we will have if we split the AIX into its own file. |
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c | ||
---|---|---|
235 | Why is this needed? For objects compiled with older compiler? |
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c | ||
---|---|---|
235 |
Yes. On AIX, we would like to allow old object files to be linkable (and function correctly) with the new compiler. On AIX, old object files really mean object files compiled with LLVM 13.0 or newer. |
Add dummy variables to allow linking in general against the profile-rt on AIX in the default linking model (-bcdtos:all).
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c | ||
---|---|---|
253 | sorry but what's the correct way to resolve this on all platforms? |
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c | ||
---|---|---|
253 | Many people don't build AIX so this isn't a problem for them (most build bots). If you want suppress the warning for the AIX specific code, you may use #pragma GCC diagnostic ignored "-Wpedantic" This works with both GCC and Clang. I do not know how IBM XL/C behaves. |
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c | ||
---|---|---|
253 | Right, I forgot this is guarded by the _AIX macro. compiler-rt/lib/profile/CMakeLists.txt: 89 if(FUCHSIA OR UNIX) 90 set(EXTRA_FLAGS 91 -fPIC 92 -Wno-pedantic) 93 endif() |
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c | ||
---|---|---|
253 | If you will not add -Wpedantic in the future, landing just the current form LGTM. |
What is the major reason that we want to share the file with Linux? Would it be better to have AIX on its own file?