PowerPC: Fix gprof starting entry point for LE

Message ID 53D7EF36.2010101@linux.vnet.ibm.com
State Committed
Headers

Commit Message

Adhemerval Zanella Netto July 29, 2014, 7 p.m. UTC
  This patch fixes the ELFv2 gprof entry point since the ABI
does not define function descriptors.  It fixes BZ#17213.

Checked on powerpc64le and it would be good if I can include it on 2.20
as well.

--

2013-07-29  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>

	[BZ #17213]
	* sysdeps/powerpc/powerpc64/entry.h: Fix TEXT_START definition for
	powerpc64le.

---
  

Comments

Carlos O'Donell July 29, 2014, 8:01 p.m. UTC | #1
On 07/29/2014 03:00 PM, Adhemerval Zanella wrote:
> This patch fixes the ELFv2 gprof entry point since the ABI
> does not define function descriptors.  It fixes BZ#17213.
> 
> Checked on powerpc64le and it would be good if I can include it on 2.20
> as well.

Looks good to me. Bug fix and an important one for ppc64le.

Please check this in for 2.20.

Cheers,
Carlos.
 
> --
> 
> 2013-07-29  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
> 
> 	[BZ #17213]
> 	* sysdeps/powerpc/powerpc64/entry.h: Fix TEXT_START definition for
> 	powerpc64le.
> 
> ---
> 
> diff --git a/sysdeps/powerpc/powerpc64/entry.h b/sysdeps/powerpc/powerpc64/entry.h
> index 76ead1d..30553c1 100644
> --- a/sysdeps/powerpc/powerpc64/entry.h
> +++ b/sysdeps/powerpc/powerpc64/entry.h
> @@ -23,6 +23,7 @@ extern void _start (void);
>  
>  #define ENTRY_POINT _start
>  
> +#if _CALL_ELF != 2
>  /* We have to provide a special declaration.  */
>  #define ENTRY_POINT_DECL(class) class void _start (void);
>  
> @@ -33,3 +34,4 @@ extern void _start (void);
>  #define TEXT_START \
>    ({ extern unsigned long int _start_as_data[] asm ("_start");  \
>       _start_as_data[0]; })
> +#endif
>
  
Carlos O'Donell July 29, 2014, 8:41 p.m. UTC | #2
On 07/29/2014 03:00 PM, Adhemerval Zanella wrote:
> This patch fixes the ELFv2 gprof entry point since the ABI
> does not define function descriptors.  It fixes BZ#17213.
> 
> Checked on powerpc64le and it would be good if I can include it on 2.20
> as well.
> 
> --
> 
> 2013-07-29  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
> 
> 	[BZ #17213]
> 	* sysdeps/powerpc/powerpc64/entry.h: Fix TEXT_START definition for
> 	powerpc64le.

If it wasn't so close to 2.20 I'd ask to see if we could have written a
regression test case for this that exercises gprof with the new libraries.

We should have a way to have detected that this was broken without having
to manually try gprof.

Cheers,
Carlos.
  
Adhemerval Zanella Netto July 30, 2014, 12:04 p.m. UTC | #3
On 29-07-2014 17:41, Carlos O'Donell wrote:
> On 07/29/2014 03:00 PM, Adhemerval Zanella wrote:
>> This patch fixes the ELFv2 gprof entry point since the ABI
>> does not define function descriptors.  It fixes BZ#17213.
>>
>> Checked on powerpc64le and it would be good if I can include it on 2.20
>> as well.
>>
>> --
>>
>> 2013-07-29  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
>>
>> 	[BZ #17213]
>> 	* sysdeps/powerpc/powerpc64/entry.h: Fix TEXT_START definition for
>> 	powerpc64le.
> If it wasn't so close to 2.20 I'd ask to see if we could have written a
> regression test case for this that exercises gprof with the new libraries.
>
> We should have a way to have detected that this was broken without having
> to manually try gprof.

I will put in my backlog to create a testcase for gprof build.

>
> Cheers,
> Carlos.
>
  

Patch

diff --git a/sysdeps/powerpc/powerpc64/entry.h b/sysdeps/powerpc/powerpc64/entry.h
index 76ead1d..30553c1 100644
--- a/sysdeps/powerpc/powerpc64/entry.h
+++ b/sysdeps/powerpc/powerpc64/entry.h
@@ -23,6 +23,7 @@  extern void _start (void);
 
 #define ENTRY_POINT _start
 
+#if _CALL_ELF != 2
 /* We have to provide a special declaration.  */
 #define ENTRY_POINT_DECL(class) class void _start (void);
 
@@ -33,3 +34,4 @@  extern void _start (void);
 #define TEXT_START \
   ({ extern unsigned long int _start_as_data[] asm ("_start");  \
      _start_as_data[0]; })
+#endif