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

Douglas Gregor dgregor at apple.com
Tue Apr 8 08:06:02 PDT 2014


On Apr 8, 2014, at 7:27 AM, Eric Christopher <echristo at gmail.com> wrote:

> This seems obvious for inclusion.

Yes, this LGTM.

	- Doug

> -eric
> 
> On Tue, Apr 8, 2014 at 12:48 PM, Hal Finkel <hfinkel at anl.gov> wrote:
>> Doug, Tom,
>> 
>> I'd like to pull this into 3.4.1.
>> 
>> -Hal
>> 
>> ----- Original Message -----
>>> From: "Hal Finkel" <hfinkel at anl.gov>
>>> To: cfe-commits at cs.uiuc.edu
>>> Sent: Sunday, March 30, 2014 8:00:07 AM
>>> Subject: r205144 - [PowerPC] Make -pg generate calls to _mcount not mcount
>>> 
>>> Author: hfinkel
>>> Date: Sun Mar 30 08:00:06 2014
>>> New Revision: 205144
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=205144&view=rev
>>> Log:
>>> [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.
>>> 
>>> Modified:
>>>    cfe/trunk/lib/Basic/Targets.cpp
>>>    cfe/trunk/test/CodeGen/mcount.c
>>> 
>>> Modified: cfe/trunk/lib/Basic/Targets.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=205144&r1=205143&r2=205144&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/Basic/Targets.cpp (original)
>>> +++ cfe/trunk/lib/Basic/Targets.cpp Sun Mar 30 08:00:06 2014
>>> @@ -355,6 +355,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;
>>> +    }
>>>   }
>>> 
>>>   const char *getStaticInitSectionSpecifier() const override {
>>> 
>>> Modified: cfe/trunk/test/CodeGen/mcount.c
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mcount.c?rev=205144&r1=205143&r2=205144&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/test/CodeGen/mcount.c (original)
>>> +++ cfe/trunk/test/CodeGen/mcount.c Sun Mar 30 08:00:06 2014
>>> @@ -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()
>>> }
>>> 
>>> 
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>> 
>> 
>> --
>> Hal Finkel
>> Assistant Computational Scientist
>> Leadership Computing Facility
>> Argonne National Laboratory
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list