diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2014-04-11 19:36:49 +0000 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2014-04-11 19:36:49 +0000 |
commit | 2c2b1619b74b7ae753d9adcdffb8ee22e4121e90 (patch) | |
tree | 0ddf2c4d6e0e97bbe34559695b795ae102a59f85 | |
parent | c26b5e82afd7bffbd0573712d679250dee33ab53 (diff) | |
download | llvm-2c2b1619b74b7ae753d9adcdffb8ee22e4121e90.zip llvm-2c2b1619b74b7ae753d9adcdffb8ee22e4121e90.tar.gz llvm-2c2b1619b74b7ae753d9adcdffb8ee22e4121e90.tar.bz2 |
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.cpp | 10 | ||||
-rw-r--r-- | clang/test/CodeGen/mcount.c | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 51d9582..c8bfda7 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 1cf3d6a..5c608bc 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() } |