[PATCH] sh: fix __HAVE_SHARED__ condition in crti.S.

Carmelo AMOROSO carmelo.amoroso at st.com
Tue Aug 26 13:53:18 UTC 2008


Takashi Yoshii wrote:
> Hi,
> 
> For SH, init/fini function prologue is defined in libc/sysdeps/linux/sh/crti.S
> as follows.
> 
> | (frame entry)
> |#ifndef __HAVE_SHARED__
> | (GOT pointer initialization)
> |#endif
> 
> I think this should be "ifdef", but "ifndef".
> Or, are there any reason that GOT should be used (only)in NON-shared case ?
> 
Well, this change has been committed by lethal at
http://www.uclibc.org/cgi-bin/viewcvs.cgi/trunk/uClibc/libc/sysdeps/linux/sh/crti.S?rev=16426&view=diff&r1=16426&r2=16425&p1=trunk/uClibc/libc/sysdeps/linux/sh/crti.S&p2=/trunk/uClibc/libc/sysdeps/linux/sh/crti.S

so, unless there something I'm not understanding too, I suppose it was a 
typo by Paul (aka lethal).
Paul, my you give some lights on this change ?

I'm wondering anyway it the could be a testcase to show a potential 
problem (if this is wrong).

Carmelo
> I did some cleanups as well as invert that conditions.
> Actually, "push r12" is not needed in non-shared case. But, I've left it
>  untouched, because I don't want to modify the function epilogue(crtn.S).
> If fixed, we will have 4 bytes smaller code. Anyone want it ?
> 
> Regards,
> /yoshii
> ---
> libc/sysdeps/linux/sh/crti.S:
>   Fix(invert) __HAVE_SHARED__ condition.
>   Reorder/eliminate instructions.
> 
> Signed-off-by: Takashi YOSHII <yoshii.takashi at renesas.com>
> ---
> diff --git a/libc/sysdeps/linux/sh/crti.S b/libc/sysdeps/linux/sh/crti.S
> index a74f96e..a092b78 100644
> --- a/libc/sysdeps/linux/sh/crti.S
> +++ b/libc/sysdeps/linux/sh/crti.S
> @@ -12,20 +12,17 @@ _init:
>  	mov.l	r12, at -r15
>  	mov.l	r14, at -r15
>  	sts.l	pr, at -r15
> -#ifndef __HAVE_SHARED__
> +	mov	r15,r14
> +#ifdef __HAVE_SHARED__
>  	mova	.L6,r0
>  	mov.l	.L6,r12
> -	add	r0,r12
> -#endif	
> -	mov	r15,r14
>  	bra	1f
> -	nop
> +	add	r0,r12
>  	.align 2
> -#ifndef __HAVE_SHARED__
>  .L6:
>  	.long	_GLOBAL_OFFSET_TABLE_
> -#endif
>  1:
> +#endif
>  	
>  	.section .fini
>  	.hidden  _fini
> @@ -37,19 +34,15 @@ _fini:
>  	mov.l	r14, at -r15
>  	sts.l	pr, at -r15
>  	mov	r15,r14
> -#ifndef __HAVE_SHARED__
> +#ifdef __HAVE_SHARED__
>  	mov.l	.L11,r12
>  	mova	.L11,r0
> -	add	r0,r12
> -#endif	
> -
>  	bra	1f
> -	nop
> +	add	r0,r12
>  	.align 2
> -#ifndef __HAVE_SHARED__
>  .L11:
>  	.long	_GLOBAL_OFFSET_TABLE_
> -#endif
>  1:
> +#endif
>  	
>  	.ident	"GCC: (GNU) 3.3.2"
> 
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://busybox.net/cgi-bin/mailman/listinfo/uclibc
> 




More information about the uClibc mailing list