powerpc: Add missing insn in swapcontext [BZ #20004]

Message ID 57221FF1.7030902@linux.vnet.ibm.com
State Committed
Delegated to: Tulio Magno Quites Machado Filho
Headers

Commit Message

Paul E. Murphy April 28, 2016, 2:36 p.m. UTC
  A missing instruction was discovered in the compat version of
swapcontext while running the GCC test suite.

2016-04-28  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
	    Segher Boessenkool  <segher@gcc.gnu.org>

	[BZ #20004]
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S:
	(__novec_swapcontext): Add missing load.
---
 sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Carlos O'Donell April 28, 2016, 3:37 p.m. UTC | #1
On 04/28/2016 10:36 AM, Paul E. Murphy wrote:
> A missing instruction was discovered in the compat version of
> swapcontext while running the GCC test suite.
> 
> 2016-04-28  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
> 	    Segher Boessenkool  <segher@gcc.gnu.org>
> 
> 	[BZ #20004]
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S:
> 	(__novec_swapcontext): Add missing load.
> ---
>  sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
> index a166dcc..a05a9cc 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
> @@ -163,6 +163,7 @@ ENTRY(__novec_swapcontext)
>    cmpdi r0,0
>    bne	  L(nv_do_sigret)
>  
> +  ld	r8,.LC__dl_hwcap@toc(r2)
>  # ifdef SHARED
>  /* Load _rtld-global._dl_hwcap.  */
>    ld    r8,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r8)
> 

How did you test this?
  
Paul E. Murphy April 28, 2016, 4:39 p.m. UTC | #2
On 04/28/2016 10:37 AM, Carlos O'Donell wrote:
> On 04/28/2016 10:36 AM, Paul E. Murphy wrote:
>> A missing instruction was discovered in the compat version of
>> swapcontext while running the GCC test suite.
>>
>> 2016-04-28  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
>> 	    Segher Boessenkool  <segher@gcc.gnu.org>
>>
>> 	[BZ #20004]
>> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S:
>> 	(__novec_swapcontext): Add missing load.
>> ---
>>  sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
>> index a166dcc..a05a9cc 100644
>> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
>> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
>> @@ -163,6 +163,7 @@ ENTRY(__novec_swapcontext)
>>    cmpdi r0,0
>>    bne	  L(nv_do_sigret)
>>  
>> +  ld	r8,.LC__dl_hwcap@toc(r2)
>>  # ifdef SHARED
>>  /* Load _rtld-global._dl_hwcap.  */
>>    ld    r8,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r8)
>>
> 
> How did you test this?

A slightly hacked up, debate-ably correct, example provided by the
makecontext man page, which is modified to explicitly call the old
version.  I directly linked the generated object files.

Without this patch it segfaults.  With it, seemingly expected output.
  
Carlos O'Donell April 28, 2016, 5:58 p.m. UTC | #3
On 04/28/2016 12:39 PM, Paul E. Murphy wrote:
> On 04/28/2016 10:37 AM, Carlos O'Donell wrote:
>> On 04/28/2016 10:36 AM, Paul E. Murphy wrote:
>>> A missing instruction was discovered in the compat version of
>>> swapcontext while running the GCC test suite.
>>>
>>> 2016-04-28  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
>>> 	    Segher Boessenkool  <segher@gcc.gnu.org>
>>>
>>> 	[BZ #20004]
>>> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S:
>>> 	(__novec_swapcontext): Add missing load.
>>> ---
>>>  sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
>>> index a166dcc..a05a9cc 100644
>>> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
>>> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
>>> @@ -163,6 +163,7 @@ ENTRY(__novec_swapcontext)
>>>    cmpdi r0,0
>>>    bne	  L(nv_do_sigret)
>>>  
>>> +  ld	r8,.LC__dl_hwcap@toc(r2)
>>>  # ifdef SHARED
>>>  /* Load _rtld-global._dl_hwcap.  */
>>>    ld    r8,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r8)
>>>
>>
>> How did you test this?
> 
> A slightly hacked up, debate-ably correct, example provided by the
> makecontext man page, which is modified to explicitly call the old
> version.  I directly linked the generated object files.
> 
> Without this patch it segfaults.  With it, seemingly expected output.

Looks good to me then :-)
  
Tulio Magno Quites Machado Filho May 3, 2016, 2:23 p.m. UTC | #4
"Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:

> A missing instruction was discovered in the compat version of
> swapcontext while running the GCC test suite.
>
> 2016-04-28  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
> 	    Segher Boessenkool  <segher@gcc.gnu.org>
>
> 	[BZ #20004]
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S:
> 	(__novec_swapcontext): Add missing load.

LGTM.
  
Paul E. Murphy May 3, 2016, 3:51 p.m. UTC | #5
Committed as cbc06bc486635347ee0da51d04a82eedf51602d5.

On 04/28/2016 09:36 AM, Paul E. Murphy wrote:
> A missing instruction was discovered in the compat version of
> swapcontext while running the GCC test suite.
> 
> 2016-04-28  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
> 	    Segher Boessenkool  <segher@gcc.gnu.org>
> 
> 	[BZ #20004]
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S:
> 	(__novec_swapcontext): Add missing load.
> ---
>  sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
> index a166dcc..a05a9cc 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
> @@ -163,6 +163,7 @@ ENTRY(__novec_swapcontext)
>    cmpdi r0,0
>    bne	  L(nv_do_sigret)
> 
> +  ld	r8,.LC__dl_hwcap@toc(r2)
>  # ifdef SHARED
>  /* Load _rtld-global._dl_hwcap.  */
>    ld    r8,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r8)
>
  

Patch

diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
index a166dcc..a05a9cc 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
@@ -163,6 +163,7 @@  ENTRY(__novec_swapcontext)
   cmpdi r0,0
   bne	  L(nv_do_sigret)
 
+  ld	r8,.LC__dl_hwcap@toc(r2)
 # ifdef SHARED
 /* Load _rtld-global._dl_hwcap.  */
   ld    r8,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r8)