]> granicus.if.org Git - clang/commitdiff
Merging r205144:
authorTom Stellard <thomas.stellard@amd.com>
Fri, 11 Apr 2014 19:36:49 +0000 (19:36 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Fri, 11 Apr 2014 19:36:49 +0000 (19:36 +0000)
------------------------------------------------------------------------
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.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@206058 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/CodeGen/mcount.c

index 51d9582e457f10ddfdac8f81e7f909fdf5a5fec7..c8bfda7e6658bbb0285f54910080fdd1e05e87de 100644 (file)
@@ -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 {
index 1cf3d6a071621cdb3d954d9cc03d7de48be32233..5c608bcd3657dc09b2e68682e6acc1d10977af4a 100644 (file)
@@ -1,4 +1,8 @@
 // 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()
 }