summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2014-04-11 19:36:49 +0000
committerTom Stellard <thomas.stellard@amd.com>2014-04-11 19:36:49 +0000
commit2c2b1619b74b7ae753d9adcdffb8ee22e4121e90 (patch)
tree0ddf2c4d6e0e97bbe34559695b795ae102a59f85
parentc26b5e82afd7bffbd0573712d679250dee33ab53 (diff)
downloadllvm-2c2b1619b74b7ae753d9adcdffb8ee22e4121e90.tar.gz
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
-rw-r--r--clang/lib/Basic/Targets.cpp10
-rw-r--r--clang/test/CodeGen/mcount.c4
2 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 51d9582e457f..c8bfda7e6658 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -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 {
diff --git a/clang/test/CodeGen/mcount.c b/clang/test/CodeGen/mcount.c
index 1cf3d6a07162..5c608bcd3657 100644
--- a/clang/test/CodeGen/mcount.c
+++ b/clang/test/CodeGen/mcount.c
@@ -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()
}