about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>2013-03-31 08:16:46 -0500
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2013-03-31 08:16:46 -0500
commitaec101aa9897a41f894f4cd9caa14e39fc73d091 (patch)
treec7ed31b118a4e35620b23307aa8e7661e7559fec
parent9d28185fb0575d987791a55961d5e399b9e9b1ef (diff)
downloadglibc-aec101aa9897a41f894f4cd9caa14e39fc73d091.tar.gz
glibc-aec101aa9897a41f894f4cd9caa14e39fc73d091.tar.xz
glibc-aec101aa9897a41f894f4cd9caa14e39fc73d091.zip
PowerPC: strchrnul for PPC32
-rw-r--r--string/strchrnul.c6
-rw-r--r--sysdeps/powerpc/powerpc32/multiarch/Makefile3
-rw-r--r--sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c7
-rw-r--r--sysdeps/powerpc/powerpc32/multiarch/strchrnul-c.c2
-rw-r--r--sysdeps/powerpc/powerpc32/multiarch/strchrnul-power7.S (renamed from sysdeps/powerpc/powerpc32/power7/strchrnul.S)6
-rw-r--r--sysdeps/powerpc/powerpc32/multiarch/strchrnul.c37
6 files changed, 55 insertions, 6 deletions
diff --git a/string/strchrnul.c b/string/strchrnul.c
index 1f63572d6c..719d3803ae 100644
--- a/string/strchrnul.c
+++ b/string/strchrnul.c
@@ -26,6 +26,9 @@
 
 #undef __strchrnul
 #undef strchrnul
+#ifdef STRCHRNUL
+# define __strchrnul STRCHRNUL
+#endif
 
 /* Find the first occurrence of C in S or the final NUL byte.  */
 char *
@@ -165,5 +168,6 @@ __strchrnul (s, c_in)
   /* This should never happen.  */
   return NULL;
 }
-
+#ifndef STRCHRNUL
 weak_alias (__strchrnul, strchrnul)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile
index 05f30428ed..fbf298af0f 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile
@@ -8,5 +8,6 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
 		   mempcpy-power7 mempcpy-c \
 		   memchr-power7 memchr-c \
 		   memrchr-power7 memrchr-c \
-		   rawmemchr-power7 rawmemchr-c
+		   rawmemchr-power7 rawmemchr-c \
+		   strchrnul-power7 strchrnul-c
 endif
diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
index 00f309f309..1399548b67 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
+++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
@@ -141,6 +141,13 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 			      __strnlen_power7)
 	      IFUNC_IMPL_ADD (array, i, strnlen, 1,
 			      __strnlen_ppc32))
+
+  IFUNC_IMPL (i, name, strchrnul,
+	      IFUNC_IMPL_ADD (array, i, strchrnul,
+			      hwcap & PPC_FEATURE_HAS_VSX,
+			      __strchrnul_power7)
+	      IFUNC_IMPL_ADD (array, i, strchrnul, 1,
+			      __strchrnul_ppc32))
 #endif
 
   return i;
diff --git a/sysdeps/powerpc/powerpc32/multiarch/strchrnul-c.c b/sysdeps/powerpc/powerpc32/multiarch/strchrnul-c.c
new file mode 100644
index 0000000000..102ea46705
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/strchrnul-c.c
@@ -0,0 +1,2 @@
+#define STRCHRNUL  __strchrnul_ppc32
+#include "string/strchrnul.c"
diff --git a/sysdeps/powerpc/powerpc32/power7/strchrnul.S b/sysdeps/powerpc/powerpc32/multiarch/strchrnul-power7.S
index d4cacab60b..fff6be74d8 100644
--- a/sysdeps/powerpc/powerpc32/power7/strchrnul.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/strchrnul-power7.S
@@ -21,7 +21,7 @@
 
 /* int [r3] strchrnul (char *s [r3], int c [r4])  */
 	.machine  power7
-ENTRY (__strchrnul)
+ENTRY (__strchrnul_power7)
 	CALL_MCOUNT
 	dcbt	0,r3
 	clrrwi	r8,r3,2	      /* Align the address to word boundary.  */
@@ -109,6 +109,4 @@ L(done):
 	srwi	r0,r0,3	      /* Convert leading zeros to bytes.  */
 	add	r3,r8,r0      /* Return address of matching c/null byte.  */
 	blr
-END (__strchrnul)
-weak_alias (__strchrnul,strchrnul)
-libc_hidden_builtin_def (__strchrnul)
+END (__strchrnul_power7)
diff --git a/sysdeps/powerpc/powerpc32/multiarch/strchrnul.c b/sysdeps/powerpc/powerpc32/multiarch/strchrnul.c
new file mode 100644
index 0000000000..874dd392d2
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/strchrnul.c
@@ -0,0 +1,37 @@
+/* Multiple versions of strchrnul.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef NOT_IN_libc
+# include <string.h>
+# include <shlib-compat.h>
+# include "init-arch.h"
+
+extern __typeof (__strchrnul) __strchrnul_ppc32 attribute_hidden;
+extern __typeof (__strchrnul) __strchrnul_power7 attribute_hidden;
+
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+   ifunc symbol properly.  */
+libc_ifunc (__strchrnul,
+	    (hwcap & PPC_FEATURE_HAS_VSX)
+            ? __strchrnul_power7
+            : __strchrnul_ppc32);
+
+weak_alias (__strchrnul, strchrnul)
+#else
+#include "string/strchrnul.c"
+#endif