olga / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone
ce426f
From 3cd86ba149cd650c338332dddb63e16f95041daf Mon Sep 17 00:00:00 2001
ce426f
From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
ce426f
Date: Wed, 30 Jul 2014 05:10:37 -0500
ce426f
Subject: [PATCH] PowerPC: multiarch memset/bzero for PowerPC64
ce426f
ce426f
commit 8a29a3d00b5d8ce33fc291baecfd59d715190fd1
ce426f
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
ce426f
Date:   Fri Dec 13 14:33:16 2013 -0500
ce426f
ce426f
---
ce426f
 sysdeps/powerpc/powerpc64/memset.S                 |  2 +
ce426f
 sysdeps/powerpc/powerpc64/multiarch/Makefile       |  3 +-
ce426f
 sysdeps/powerpc/powerpc64/multiarch/bzero-power4.S | 26 ++++++++++
ce426f
 sysdeps/powerpc/powerpc64/multiarch/bzero-power6.S | 26 ++++++++++
ce426f
 sysdeps/powerpc/powerpc64/multiarch/bzero-power7.S | 26 ++++++++++
ce426f
 sysdeps/powerpc/powerpc64/multiarch/bzero.c        | 40 ++++++++++++++++
ce426f
 .../powerpc/powerpc64/multiarch/ifunc-impl-list.c  | 20 ++++++++
ce426f
 .../powerpc/powerpc64/multiarch/memset-power4.S    | 40 ++++++++++++++++
ce426f
 .../powerpc/powerpc64/multiarch/memset-power6.S    | 40 ++++++++++++++++
ce426f
 .../powerpc/powerpc64/multiarch/memset-power7.S    | 40 ++++++++++++++++
ce426f
 sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S | 55 ++++++++++++++++++++++
ce426f
 sysdeps/powerpc/powerpc64/multiarch/memset.c       | 50 ++++++++++++++++++++
ce426f
 sysdeps/powerpc/powerpc64/multiarch/rtld-memset.c  | 18 +++++++
ce426f
 sysdeps/powerpc/powerpc64/power4/memset.S          |  2 +
ce426f
 sysdeps/powerpc/powerpc64/power6/memset.S          |  2 +
ce426f
 sysdeps/powerpc/powerpc64/power7/memset.S          |  2 +
ce426f
 16 files changed, 391 insertions(+), 1 deletion(-)
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/bzero-power4.S
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/bzero-power6.S
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/bzero-power7.S
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/bzero.c
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memset-power4.S
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memset-power6.S
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memset-power7.S
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memset.c
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/rtld-memset.c
ce426f
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/memset.S
ce426f
index d02af98..fd5d4e5 100644
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/memset.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/memset.S
ce426f
@@ -265,6 +265,7 @@ L(medium_28t):
ce426f
 END_GEN_TB (BP_SYM (memset),TB_TOCLESS)
ce426f
 libc_hidden_builtin_def (memset)
ce426f
 
ce426f
+#ifndef NO_BZERO_IMPL
ce426f
 /* Copied from bzero.S to prevent the linker from inserting a stub
ce426f
    between bzero and memset.  */
ce426f
 ENTRY (BP_SYM (__bzero))
ce426f
@@ -284,3 +285,4 @@ ENTRY (BP_SYM (__bzero))
ce426f
 END_GEN_TB (BP_SYM (__bzero),TB_TOCLESS)
ce426f
 
ce426f
 weak_alias (BP_SYM (__bzero), BP_SYM (bzero))
ce426f
+#endif
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
ce426f
index c0bc520..424d2cd 100644
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
ce426f
@@ -1,5 +1,6 @@
ce426f
 ifeq ($(subdir),string)
ce426f
 sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
ce426f
                   memcpy-power4 memcpy-ppc64 memcmp-power7 memcmp-power4 \
ce426f
-                  memcmp-ppc64
ce426f
+                  memcmp-ppc64 memset-power7 memset-power6 memset-power4 \
ce426f
+                  memset-ppc64 bzero-power4 bzero-power6 bzero-power7
ce426f
 endif
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/bzero-power4.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/bzero-power4.S
ce426f
new file mode 100644
ce426f
index 0000000..72b75ac
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/bzero-power4.S
ce426f
@@ -0,0 +1,26 @@
ce426f
+/* Optimized bzero implementation for PowerPC64/POWER4.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <sysdep.h>
ce426f
+
ce426f
+ENTRY (__bzero_power4)
ce426f
+	CALL_MCOUNT 3
ce426f
+	mr	r5,r4
ce426f
+	li	r4,0
ce426f
+	b	__memset_power4
ce426f
+END_GEN_TB (__bzero_power4,TB_TOCLESS)
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/bzero-power6.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/bzero-power6.S
ce426f
new file mode 100644
ce426f
index 0000000..d0917c5
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/bzero-power6.S
ce426f
@@ -0,0 +1,26 @@
ce426f
+/* Optimized bzero implementation for PowerPC64/POWER6.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <sysdep.h>
ce426f
+
ce426f
+ENTRY (__bzero_power6)
ce426f
+	CALL_MCOUNT 3
ce426f
+	mr	r5,r4
ce426f
+	li	r4,0
ce426f
+	b	__memset_power6
ce426f
+END_GEN_TB (__bzero_power6,TB_TOCLESS)
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/bzero-power7.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/bzero-power7.S
ce426f
new file mode 100644
ce426f
index 0000000..0ec285a
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/bzero-power7.S
ce426f
@@ -0,0 +1,26 @@
ce426f
+/* Optimized bzero implementation for PowerPC64/POWER7.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <sysdep.h>
ce426f
+
ce426f
+ENTRY (__bzero_power7)
ce426f
+	CALL_MCOUNT 3
ce426f
+	mr	r5,r4
ce426f
+	li	r4,0
ce426f
+	b	__memset_power7
ce426f
+END_GEN_TB (__bzero_power7,TB_TOCLESS)
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/bzero.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/bzero.c
ce426f
new file mode 100644
ce426f
index 0000000..ed83541
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/bzero.c
ce426f
@@ -0,0 +1,40 @@
ce426f
+/* Multiple versions of bzero. PowerPC64 version.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+/* Define multiple versions only for definition in libc.  */
ce426f
+#ifndef NOT_IN_libc
ce426f
+# include <string.h>
ce426f
+# include <strings.h>
ce426f
+# include "init-arch.h"
ce426f
+
ce426f
+extern __typeof (bzero) __bzero_ppc attribute_hidden;
ce426f
+extern __typeof (bzero) __bzero_power4 attribute_hidden;
ce426f
+extern __typeof (bzero) __bzero_power6 attribute_hidden;
ce426f
+extern __typeof (bzero) __bzero_power7 attribute_hidden;
ce426f
+
ce426f
+libc_ifunc (__bzero,
ce426f
+            (hwcap & PPC_FEATURE_HAS_VSX)
ce426f
+            ? __bzero_power7 :
ce426f
+	      (hwcap & PPC_FEATURE_ARCH_2_05)
ce426f
+		? __bzero_power6 :
ce426f
+		  (hwcap & PPC_FEATURE_POWER4)
ce426f
+		? __bzero_power4
ce426f
+            : __bzero_ppc);
ce426f
+
ce426f
+weak_alias (__bzero, bzero)
ce426f
+#endif
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
ce426f
index 295ebca..11e7063 100644
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
ce426f
@@ -60,6 +60,16 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
ce426f
              IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_POWER4,
ce426f
                              __memcpy_power4)
ce426f
              IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ppc))
ce426f
+
ce426f
+  /* Support sysdeps/powerpc/powerpc64/multiarch/memset.c.  */
ce426f
+  IFUNC_IMPL (i, name, memset,
ce426f
+             IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_HAS_VSX,
ce426f
+                             __memset_power7)
ce426f
+             IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_ARCH_2_05,
ce426f
+                             __memset_power6)
ce426f
+             IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_POWER4,
ce426f
+                             __memset_power4)
ce426f
+             IFUNC_IMPL_ADD (array, i, memset, 1, __memset_ppc))
ce426f
 #endif
ce426f
 
ce426f
   /* Support sysdeps/powerpc/powerpc64/multiarch/memcmp.c.  */
ce426f
@@ -70,5 +80,15 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
ce426f
                              __memcmp_power4)
ce426f
              IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_ppc))
ce426f
 
ce426f
+  /* Support sysdeps/powerpc/powerpc64/multiarch/bzero.c.  */
ce426f
+  IFUNC_IMPL (i, name, bzero,
ce426f
+             IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_HAS_VSX,
ce426f
+                             __bzero_power7)
ce426f
+             IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_ARCH_2_05,
ce426f
+                             __bzero_power6)
ce426f
+             IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_POWER4,
ce426f
+                             __bzero_power4)
ce426f
+             IFUNC_IMPL_ADD (array, i, bzero, 1, __bzero_ppc))
ce426f
+
ce426f
   return i;
ce426f
 }
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memset-power4.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memset-power4.S
ce426f
new file mode 100644
ce426f
index 0000000..9074b95
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memset-power4.S
ce426f
@@ -0,0 +1,40 @@
ce426f
+/* Optimized memset implementation for PowerPC64/POWER4.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <sysdep.h>
ce426f
+
ce426f
+#undef EALIGN
ce426f
+#define EALIGN(name, alignt, words)				\
ce426f
+  .section ".text";						\
ce426f
+  ENTRY_2(__memset_power4)					\
ce426f
+  .align ALIGNARG(alignt);					\
ce426f
+  EALIGN_W_##words;						\
ce426f
+  BODY_LABEL(__memset_power4):					\
ce426f
+  cfi_startproc;
ce426f
+
ce426f
+#undef END_GEN_TB
ce426f
+#define END_GEN_TB(name, mask)					\
ce426f
+  cfi_endproc;							\
ce426f
+  TRACEBACK_MASK(__memset_power4,mask)				\
ce426f
+  END_2(__memset_power4)
ce426f
+
ce426f
+#undef libc_hidden_builtin_def
ce426f
+#define libc_hidden_builtin_def(name)
ce426f
+
ce426f
+#define NO_BZERO_IMPL
ce426f
+#include <sysdeps/powerpc/powerpc64/power4/memset.S>
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memset-power6.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memset-power6.S
ce426f
new file mode 100644
ce426f
index 0000000..70688b5
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memset-power6.S
ce426f
@@ -0,0 +1,40 @@
ce426f
+/* Optimized memset implementation for PowerPC64/POWER6.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <sysdep.h>
ce426f
+
ce426f
+#undef EALIGN
ce426f
+#define EALIGN(name, alignt, words)				\
ce426f
+  .section ".text";						\
ce426f
+  ENTRY_2(__memset_power6)					\
ce426f
+  .align ALIGNARG(alignt);					\
ce426f
+  EALIGN_W_##words;						\
ce426f
+  BODY_LABEL(__memset_power6):					\
ce426f
+  cfi_startproc;
ce426f
+
ce426f
+#undef END_GEN_TB
ce426f
+#define END_GEN_TB(name, mask)					\
ce426f
+  cfi_endproc;							\
ce426f
+  TRACEBACK_MASK(__memset_power6,mask)				\
ce426f
+  END_2(__memset_power6)
ce426f
+
ce426f
+#undef libc_hidden_builtin_def
ce426f
+#define libc_hidden_builtin_def(name)
ce426f
+
ce426f
+#define NO_BZERO_IMPL
ce426f
+#include <sysdeps/powerpc/powerpc64/power6/memset.S>
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memset-power7.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memset-power7.S
ce426f
new file mode 100644
ce426f
index 0000000..ab226c5
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memset-power7.S
ce426f
@@ -0,0 +1,40 @@
ce426f
+/* Optimized memset implementation for PowerPC64/POWER7.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <sysdep.h>
ce426f
+
ce426f
+#undef EALIGN
ce426f
+#define EALIGN(name, alignt, words)				\
ce426f
+  .section ".text";						\
ce426f
+  ENTRY_2(__memset_power7)					\
ce426f
+  .align ALIGNARG(alignt);					\
ce426f
+  EALIGN_W_##words;						\
ce426f
+  BODY_LABEL(__memset_power7):					\
ce426f
+  cfi_startproc;
ce426f
+
ce426f
+#undef END_GEN_TB
ce426f
+#define END_GEN_TB(name, mask)					\
ce426f
+  cfi_endproc;							\
ce426f
+  TRACEBACK_MASK(__memset_power7,mask)				\
ce426f
+  END_2(__memset_power7)
ce426f
+
ce426f
+#undef libc_hidden_builtin_def
ce426f
+#define libc_hidden_builtin_def(name)
ce426f
+
ce426f
+#define NO_BZERO_IMPL
ce426f
+#include <sysdeps/powerpc/powerpc64/power7/memset.S>
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
ce426f
new file mode 100644
ce426f
index 0000000..dc5549c
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
ce426f
@@ -0,0 +1,55 @@
ce426f
+/* Default memset/bzero implementation for PowerPC64.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <sysdep.h>
ce426f
+
ce426f
+/* Copied from bzero.S to prevent the linker from inserting a stub
ce426f
+   between bzero and memset.  NOTE: this code should be positioned
ce426f
+   before ENTRY/END_GEN_TB redefinition.  */
ce426f
+ENTRY (__bzero_ppc)
ce426f
+        CALL_MCOUNT 3
ce426f
+        mr      r5,r4
ce426f
+        li      r4,0
ce426f
+        b       L(_memset)
ce426f
+END_GEN_TB (__bzero_ppc,TB_TOCLESS)
ce426f
+
ce426f
+
ce426f
+#if defined SHARED && !defined NOT_IN_libc
ce426f
+# undef EALIGN
ce426f
+# define EALIGN(name, alignt, words)				\
ce426f
+  .section ".text";						\
ce426f
+  ENTRY_2(__memset_ppc)						\
ce426f
+  .align ALIGNARG(alignt);					\
ce426f
+  EALIGN_W_##words;						\
ce426f
+  BODY_LABEL(__memset_ppc):					\
ce426f
+  cfi_startproc;
ce426f
+
ce426f
+# undef END_GEN_TB
ce426f
+# define END_GEN_TB(name, mask)					\
ce426f
+  cfi_endproc;							\
ce426f
+  TRACEBACK_MASK(__memset_ppc,mask)				\
ce426f
+  END_2(__memset_ppc)
ce426f
+
ce426f
+# undef libc_hidden_builtin_def
ce426f
+# define libc_hidden_builtin_def(name)
ce426f
+#endif
ce426f
+
ce426f
+/* Do not implement __bzero at powerpc64/memset.S.  */
ce426f
+#define NO_BZERO_IMPL
ce426f
+
ce426f
+#include <sysdeps/powerpc/powerpc64/memset.S>
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memset.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memset.c
ce426f
new file mode 100644
ce426f
index 0000000..aa2ae70
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memset.c
ce426f
@@ -0,0 +1,50 @@
ce426f
+/* Multiple versions of memset.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+/* Define multiple versions only for definition in libc.  */
ce426f
+#if defined SHARED && !defined NOT_IN_libc
ce426f
+/* Redefine memset so that the compiler won't complain about the type
ce426f
+   mismatch with the IFUNC selector in strong_alias, below.  */
ce426f
+# undef memset
ce426f
+# define memset __redirect_memset
ce426f
+# include <string.h>
ce426f
+# include <shlib-compat.h>
ce426f
+# include "init-arch.h"
ce426f
+
ce426f
+extern __typeof (__redirect_memset) __libc_memset;
ce426f
+
ce426f
+extern __typeof (__redirect_memset) __memset_ppc attribute_hidden;
ce426f
+extern __typeof (__redirect_memset) __memset_power4 attribute_hidden;
ce426f
+extern __typeof (__redirect_memset) __memset_power6 attribute_hidden;
ce426f
+extern __typeof (__redirect_memset) __memset_power7 attribute_hidden;
ce426f
+
ce426f
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
ce426f
+   ifunc symbol properly.  */
ce426f
+libc_ifunc (__libc_memset,
ce426f
+            (hwcap & PPC_FEATURE_HAS_VSX)
ce426f
+            ? __memset_power7 :
ce426f
+	      (hwcap & PPC_FEATURE_ARCH_2_05)
ce426f
+		? __memset_power6 :
ce426f
+		  (hwcap & PPC_FEATURE_POWER4)
ce426f
+		? __memset_power4
ce426f
+            : __memset_ppc);
ce426f
+
ce426f
+#undef memset
ce426f
+strong_alias (__libc_memset, memset);
ce426f
+libc_hidden_ver (__libc_memset, memset);
ce426f
+#endif
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/rtld-memset.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/rtld-memset.c
ce426f
new file mode 100644
ce426f
index 0000000..8eac85b
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/rtld-memset.c
ce426f
@@ -0,0 +1,18 @@
ce426f
+/* Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <sysdeps/powerpc/powerpc64/rtld-memset.c>
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/memset.S
ce426f
index c86a68a..c077ae7 100644
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/memset.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/memset.S
ce426f
@@ -253,6 +253,7 @@ L(medium_28t):
ce426f
 END_GEN_TB (BP_SYM (memset),TB_TOCLESS)
ce426f
 libc_hidden_builtin_def (memset)
ce426f
 
ce426f
+#ifndef NO_BZERO_IMPL
ce426f
 /* Copied from bzero.S to prevent the linker from inserting a stub
ce426f
    between bzero and memset.  */
ce426f
 ENTRY (BP_SYM (__bzero))
ce426f
@@ -272,3 +273,4 @@ ENTRY (BP_SYM (__bzero))
ce426f
 END_GEN_TB (BP_SYM (__bzero),TB_TOCLESS)
ce426f
 
ce426f
 weak_alias (BP_SYM (__bzero), BP_SYM (bzero))
ce426f
+#endif
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power6/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power6/memset.S
ce426f
index 930ecce..967642a3 100644
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power6/memset.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power6/memset.S
ce426f
@@ -397,6 +397,7 @@ L(medium_28t):
ce426f
 END_GEN_TB (BP_SYM (memset),TB_TOCLESS)
ce426f
 libc_hidden_builtin_def (memset)
ce426f
 
ce426f
+#ifndef NO_BZERO_IMPL
ce426f
 /* Copied from bzero.S to prevent the linker from inserting a stub
ce426f
    between bzero and memset.  */
ce426f
 ENTRY (BP_SYM (__bzero))
ce426f
@@ -416,3 +417,4 @@ ENTRY (BP_SYM (__bzero))
ce426f
 END_GEN_TB (BP_SYM (__bzero),TB_TOCLESS)
ce426f
 
ce426f
 weak_alias (BP_SYM (__bzero), BP_SYM (bzero))
ce426f
+#endif
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/memset.S
ce426f
index 5970fbe..2716656 100644
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/memset.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/memset.S
ce426f
@@ -385,6 +385,7 @@ L(small):
ce426f
 END_GEN_TB (BP_SYM (memset),TB_TOCLESS)
ce426f
 libc_hidden_builtin_def (memset)
ce426f
 
ce426f
+#ifndef NO_BZERO_IMPL
ce426f
 /* Copied from bzero.S to prevent the linker from inserting a stub
ce426f
    between bzero and memset.  */
ce426f
 ENTRY (BP_SYM (__bzero))
ce426f
@@ -395,3 +396,4 @@ ENTRY (BP_SYM (__bzero))
ce426f
 END_GEN_TB (BP_SYM (__bzero),TB_TOCLESS)
ce426f
 
ce426f
 weak_alias (BP_SYM (__bzero), BP_SYM (bzero))
ce426f
+#endif
ce426f
-- 
ce426f
1.8.3.1
ce426f