diff mbox

powerpc: Fix TOC stub on powerpc64 clone()

Message ID 1477083962-9894-1-git-send-email-tuliom@linux.vnet.ibm.com
State New
Headers show

Commit Message

Tulio Magno Quites Machado Filho Oct. 21, 2016, 9:06 p.m. UTC
Use a function call to _exit() so that the linker can create a TOC stub
instead of just a branch.

2016-10-21  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>

	[BZ #20728]
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Replace a
	branch to _exit() by a function call.
---
 sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Adhemerval Zanella Netto Oct. 21, 2016, 9:48 p.m. UTC | #1
LGTM, it follows what GCC generated for non retur  functions. I am
assuming you actually tested on powerpc64.

On 21/10/2016 19:06, Tulio Magno Quites Machado Filho wrote:
> Use a function call to _exit() so that the linker can create a TOC stub
> instead of just a branch.
> 
> 2016-10-21  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
> 
> 	[BZ #20728]
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Replace a
> 	branch to _exit() by a function call.
> ---
>  sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
> index 7c59b9b..df824f5 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
> @@ -97,7 +97,7 @@ L(oldpid):
>  #ifdef SHARED
>  	b	JUMPTARGET(__GI__exit)
>  #else
> -	b	JUMPTARGET(_exit)
> +	bl	JUMPTARGET(_exit)
>  	/* We won't ever get here but provide a nop so that the linker
>  	   will insert a toc adjusting stub if necessary.  */
>  	nop
>
Carlos O'Donell Oct. 28, 2016, 11:58 a.m. UTC | #2
On 10/21/2016 05:06 PM, Tulio Magno Quites Machado Filho wrote:
> Use a function call to _exit() so that the linker can create a TOC stub
> instead of just a branch.
> 
> 2016-10-21  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
> 
> 	[BZ #20728]
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Replace a
> 	branch to _exit() by a function call.
> ---
>  sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
> index 7c59b9b..df824f5 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
> @@ -97,7 +97,7 @@ L(oldpid):
>  #ifdef SHARED
>  	b	JUMPTARGET(__GI__exit)
>  #else
> -	b	JUMPTARGET(_exit)
> +	bl	JUMPTARGET(_exit)
>  	/* We won't ever get here but provide a nop so that the linker
>  	   will insert a toc adjusting stub if necessary.  */
>  	nop
 
I agree with Adhemerval that this _looks_ good, but you'd have to claim
it works _and_ review the final linked code generated by the static linker.
Tulio Magno Quites Machado Filho Oct. 28, 2016, 8:16 p.m. UTC | #3
Carlos O'Donell <carlos@redhat.com> writes:

> I agree with Adhemerval that this _looks_ good, but you'd have to claim
> it works _and_ review the final linked code generated by the static linker.

Yes, I managed to validate this on powerpc64.
I'll reword my commit message to mention this and will commit it to master.

Thank you Adhemerval and Carlos,
diff mbox

Patch

diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
index 7c59b9b..df824f5 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
@@ -97,7 +97,7 @@  L(oldpid):
 #ifdef SHARED
 	b	JUMPTARGET(__GI__exit)
 #else
-	b	JUMPTARGET(_exit)
+	bl	JUMPTARGET(_exit)
 	/* We won't ever get here but provide a nop so that the linker
 	   will insert a toc adjusting stub if necessary.  */
 	nop