diff mbox

PowerPC: Fix bzero definition for static libc for PPC32

Message ID 532069BF.70806@linux.vnet.ibm.com
State Not Applicable
Headers show

Commit Message

Adhemerval Zanella Netto March 12, 2014, 2:05 p.m. UTC
Pushed upstream as dd3946c615184e1957a0cb09352cac72be5d6d5b with a
modification:



On 11-03-2014 10:11, Adhemerval Zanella wrote:
> This patch fixes an issue for powerpc32 static build where __bzero
> is not defined. This patch adds an IFUNC implementation for the symbol
> in static build and correct a wrong calling for a non-existing
> __memset_ppc in default __bzero_ppc.
>
> Fixes BZ#16689 and this patch is against the previous to fix bzero for PPC64
> https://sourceware.org/ml/libc-alpha/2014-03/msg00211.html. If no one opposes
> I will push it tomorrow.
>
> Tested on powerpc32-fpu build with --with-cpu=power4 and --with-cpu=power7.
>
> --
>
> 2014-03-11  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
>
> 	[BZ #16689]
> 	* sysdeps/powerpc/powerpc32/power4/multiarch/bzero-ppc32.S
> 	(__bzero_ppc): Call memset@local instead of __memset_ppc@local.
> 	Define it for static builds as well.
> 	* sysdeps/powerpc/powerpc32/power4/multiarch/bzero.c: Build IFUNC
> 	selector for static builds.
>
> ---
>
> diff --git a/NEWS b/NEWS
> index df126f3..897475e 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -10,7 +10,7 @@ Version 2.20
>  * The following bugs are resolved with this release:
>
>    15347, 15804, 15894, 16447, 16532, 16545, 16574, 16600, 16609, 16610,
> -  16611, 16613, 16623, 16632, 16639, 16670, 16674, 16683.
> +  16611, 16613, 16623, 16632, 16639, 16670, 16674, 16683, 16689.
>
>  * The am33 port, which had not worked for several years, has been removed
>    from ports.
> diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/bzero-ppc32.S b/sysdeps/powerpc/powerpc32/power4/multiarch/bzero-ppc32.S
> index 7a7cca9..71fbead 100644
> --- a/sysdeps/powerpc/powerpc32/power4/multiarch/bzero-ppc32.S
> +++ b/sysdeps/powerpc/powerpc32/power4/multiarch/bzero-ppc32.S
> @@ -22,5 +22,5 @@
>  ENTRY (__bzero_ppc)
>          mr      r5,r4
>          li      r4,0
> -        b       __memset_ppc@local
> +        b       memset@local
>  END (__bzero_ppc)
> diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/bzero.c b/sysdeps/powerpc/powerpc32/power4/multiarch/bzero.c
> index 2a6298a..baaa6b4 100644
> --- a/sysdeps/powerpc/powerpc32/power4/multiarch/bzero.c
> +++ b/sysdeps/powerpc/powerpc32/power4/multiarch/bzero.c
> @@ -17,7 +17,7 @@
>     <http://www.gnu.org/licenses/>.  */
>
>  /* Define multiple versions only for definition in libc.  */
> -#if defined SHARED && !defined NOT_IN_libc
> +#ifndef NOT_IN_libc
>  # include <string.h>
>  # include <strings.h>
>  # include "init-arch.h"
>
diff mbox

Patch

diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/bzero-ppc32.S b/sysdeps/powerpc/powerpc32/power4/multiarch/bzero-ppc32.S
index 7a7cca9..80a2dc5 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/bzero-ppc32.S
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/bzero-ppc32.S
@@ -19,8 +19,17 @@ 

 #include <sysdep.h>

+/* memset ifunc selector is not built for static and memset@local
+   for shared builds makes the linker point the call to the ifunc
+   selector.  */
+#ifdef SHARED
+# define MEMSET __memset_ppc
+#else
+# define MEMSET memset
+#endif
+
 ENTRY (__bzero_ppc)
         mr      r5,r4
         li      r4,0
-        b       __memset_ppc@local
+        b       MEMSET@local
 END (__bzero_ppc)