Commit 2c2b1619 authored by Tom Stellard's avatar Tom Stellard
Browse files

Merging r205144:

------------------------------------------------------------------------
r205144 | hfinkel | 2014-03-30 09:00:06 -0400 (Sun, 30 Mar 2014) | 7 lines

[PowerPC] Make -pg generate calls to _mcount not mcount

At least on REL6 (Linux/glibc 2.12), the proper symbol for generating gprof
data is _mcount, not mcount. Prior to this change, compiling with -pg would
generate linking errors (because of unresolved references to mcount), after
this change -pg seems at least minimally functional.

------------------------------------------------------------------------

llvm-svn: 206058
parent c26b5e82
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -358,6 +358,16 @@ public:
  LinuxTargetInfo(const llvm::Triple &Triple) : OSTargetInfo<Target>(Triple) {
    this->UserLabelPrefix = "";
    this->WIntType = TargetInfo::UnsignedInt;

    switch (Triple.getArch()) {
    default:
      break;
    case llvm::Triple::ppc:
    case llvm::Triple::ppc64:
    case llvm::Triple::ppc64le:
      this->MCountName = "_mcount";
      break;
    }
  }

  virtual const char *getStaticInitSectionSpecifier() const {
+4 −0
Original line number Diff line number Diff line
// RUN: %clang_cc1 -pg -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -pg -triple powerpc-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-PPC %s
// RUN: %clang_cc1 -pg -triple powerpc64-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-PPC %s
// RUN: %clang_cc1 -pg -triple powerpc64le-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-PPC %s
void foo(void) {
// CHECK: call void @mcount()
// CHECK-PPC: call void @_mcount()
}