[clang][AIX] Fix mcount name and call arguments
authorMichael Francis <michaelfrancis@ibm.com>
Tue, 18 Oct 2022 15:47:53 +0000 (15:47 +0000)
committerChris Bowler <cbowler@ca.ibm.com>
Thu, 20 Oct 2022 20:20:00 +0000 (16:20 -0400)
commit922f42d531b873db59fce81aefa4dcaae999d5ce
treeb3cc786373070a95177fa8a7bce0d3acdbc18af6
parent0128f8016770655fe7a40d3657f00853e6badb93
[clang][AIX] Fix mcount name and call arguments

Currently, compiling a program with the `-pg` flag will result in an
undefined symbol error for `.mcount`. This revision fixes the call to
use `__mcount`, which requires a pointer argument to a pointer-sized
object (unique per inserted call) on AIX.

This is only a partial fix. This patch should fix the `-pg` flag's
behaviour on AIX to work with code you are compiling, but it will not
link against standard libraries with `mcount` instrumentation calls. The
next step is to add profiled libraries to the linker search paths in the
Clang driver for the AIX toolchain when linking with `-pg`.

Differential Review: https://reviews.llvm.org/D135384
clang/lib/Basic/Targets/OSTargets.h
clang/test/CodeGen/mcount-aix.c [new file with mode: 0644]
llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp