]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
PowerPC: strchrnul for PPC32
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Sun, 31 Mar 2013 13:16:46 +0000 (08:16 -0500)
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Sun, 31 Mar 2013 13:16:46 +0000 (08:16 -0500)
string/strchrnul.c
sysdeps/powerpc/powerpc32/multiarch/Makefile
sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
sysdeps/powerpc/powerpc32/multiarch/strchrnul-c.c [new file with mode: 0644]
sysdeps/powerpc/powerpc32/multiarch/strchrnul-power7.S [moved from sysdeps/powerpc/powerpc32/power7/strchrnul.S with 96% similarity]
sysdeps/powerpc/powerpc32/multiarch/strchrnul.c [new file with mode: 0644]

index 1f63572d6cb0740e0c7410e4640c869109314184..719d3803aeb68b4e31ae8889b9cb96e18b0a961f 100644 (file)
@@ -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
index 05f30428ed241c06e917d064bcaf6684dc180666..fbf298af0fffc483326bb39784e9f683e147a4a0 100644 (file)
@@ -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
index 00f309f309df4f437573cf9b78f46a85d3c969ac..1399548b67cfefdca1925def5989e147cdbb90d1 100644 (file)
@@ -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 (file)
index 0000000..102ea46
--- /dev/null
@@ -0,0 +1,2 @@
+#define STRCHRNUL  __strchrnul_ppc32
+#include "string/strchrnul.c"
similarity index 96%
rename from sysdeps/powerpc/powerpc32/power7/strchrnul.S
rename to sysdeps/powerpc/powerpc32/multiarch/strchrnul-power7.S
index d4cacab60bf766c32bb66d21afdf69201725801a..fff6be74d8b5e3675ed1c26dc74885c121d4655c 100644 (file)
@@ -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 (file)
index 0000000..874dd39
--- /dev/null
@@ -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