Michael Francis 922f42d531 [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
2022-10-20 16:20:00 -04:00

26 lines
869 B
C

// RUN: %clang_cc1 -pg -triple powerpc-ibm-aix7.2.0.0 -S -emit-llvm %s -o - | FileCheck %s
// RUN: %clang_cc1 -pg -triple powerpc64-ibm-aix7.2.0.0 -S -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK64
void foo() {
}
void bar() {
foo();
}
// CHECK: @[[GLOB0:[0-9]+]] = internal global i32 0
// CHECK: @[[GLOB1:[0-9]+]] = internal global i32 0
// CHECK64: @[[GLOB0:[0-9]+]] = internal global i64 0
// CHECK64: @[[GLOB1:[0-9]+]] = internal global i64 0
// CHECK-LABEL: @foo(
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @__mcount(ptr @[[GLOB0]])
// CHECK64-LABEL: @foo(
// CHECK64-NEXT: entry:
// CHECK64-NEXT: call void @__mcount(ptr @[[GLOB0]])
// CHECK-LABEL: @bar(
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @__mcount(ptr @[[GLOB1]])
// CHECK64-LABEL: @bar(
// CHECK64-NEXT: entry:
// CHECK64-NEXT: call void @__mcount(ptr @[[GLOB1]])