|
|
ce426f |
From dc5a73198455f4492a44dbc71fdadeb7551d5810 Mon Sep 17 00:00:00 2001
|
|
|
ce426f |
From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
|
|
|
ce426f |
Date: Wed, 30 Jul 2014 05:41:40 -0500
|
|
|
ce426f |
Subject: [PATCH] PowerPC: multiarch strnlen for PowerPC64
|
|
|
ce426f |
|
|
|
ce426f |
commit 62982bf9782f0f3ef4259fc03b1b557f1332b182
|
|
|
ce426f |
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
|
|
ce426f |
Date: Fri Dec 13 14:38:50 2013 -0500
|
|
|
ce426f |
|
|
|
ce426f |
Added sysdeps/powerpc/powerpc32/power4/multiarch/strnlen-ppc32.c
|
|
|
ce426f |
apart from original commit.
|
|
|
ce426f |
---
|
|
|
ce426f |
.../powerpc32/power4/multiarch/strnlen-ppc32.c | 26 ++++++++++++++
|
|
|
ce426f |
sysdeps/powerpc/powerpc64/multiarch/Makefile | 3 +-
|
|
|
ce426f |
.../powerpc/powerpc64/multiarch/ifunc-impl-list.c | 7 ++++
|
|
|
ce426f |
.../powerpc/powerpc64/multiarch/strnlen-power7.S | 40 ++++++++++++++++++++++
|
|
|
ce426f |
.../powerpc/powerpc64/multiarch/strnlen-ppc64.c | 18 ++++++++++
|
|
|
ce426f |
sysdeps/powerpc/powerpc64/multiarch/strnlen.c | 36 +++++++++++++++++++
|
|
|
ce426f |
6 files changed, 129 insertions(+), 1 deletion(-)
|
|
|
ce426f |
create mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/strnlen-ppc32.c
|
|
|
ce426f |
create mode 100644 sysdeps/powerpc/powerpc64/multiarch/strnlen-power7.S
|
|
|
ce426f |
create mode 100644 sysdeps/powerpc/powerpc64/multiarch/strnlen-ppc64.c
|
|
|
ce426f |
create mode 100644 sysdeps/powerpc/powerpc64/multiarch/strnlen.c
|
|
|
ce426f |
|
|
|
ce426f |
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/multiarch/strnlen-ppc32.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/multiarch/strnlen-ppc32.c
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..676d837
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/multiarch/strnlen-ppc32.c
|
|
|
ce426f |
@@ -0,0 +1,26 @@
|
|
|
ce426f |
+/* Default strnlen implementation for PowerPC32.
|
|
|
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 STRNLEN __strnlen_ppc
|
|
|
ce426f |
+#ifdef SHARED
|
|
|
ce426f |
+# undef libc_hidden_def
|
|
|
ce426f |
+# define libc_hidden_def(name) \
|
|
|
ce426f |
+ __hidden_ver1 (__strnlen_ppc, __GI_strnlen, __strnlen_ppc);
|
|
|
ce426f |
+#endif
|
|
|
ce426f |
+
|
|
|
ce426f |
+#include <string/strnlen.c>
|
|
|
ce426f |
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
|
|
|
ce426f |
index 9da7be1..3285fd7 100644
|
|
|
ce426f |
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
|
|
|
ce426f |
@@ -5,5 +5,6 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
|
|
|
ce426f |
memset-ppc64 bzero-power4 bzero-power6 bzero-power7 \
|
|
|
ce426f |
mempcpy-power7 mempcpy-ppc64 memchr-power7 memchr-ppc64 \
|
|
|
ce426f |
memrchr-power7 memrchr-ppc64 rawmemchr-power7 \
|
|
|
ce426f |
- rawmemchr-ppc64 strlen-power7 strlen-ppc64
|
|
|
ce426f |
+ rawmemchr-ppc64 strlen-power7 strlen-ppc64 strnlen-power7 \
|
|
|
ce426f |
+ strnlen-ppc64
|
|
|
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 bdc908b..c9125b8 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 |
@@ -129,5 +129,12 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
ce426f |
IFUNC_IMPL_ADD (array, i, rawmemchr, 1,
|
|
|
ce426f |
__rawmemchr_ppc))
|
|
|
ce426f |
|
|
|
ce426f |
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strnlen.c. */
|
|
|
ce426f |
+ IFUNC_IMPL (i, name, strnlen,
|
|
|
ce426f |
+ IFUNC_IMPL_ADD (array, i, strnlen, hwcap & PPC_FEATURE_HAS_VSX,
|
|
|
ce426f |
+ __strnlen_power7)
|
|
|
ce426f |
+ IFUNC_IMPL_ADD (array, i, strnlen, 1,
|
|
|
ce426f |
+ __strnlen_ppc))
|
|
|
ce426f |
+
|
|
|
ce426f |
return i;
|
|
|
ce426f |
}
|
|
|
ce426f |
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strnlen-power7.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strnlen-power7.S
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..909aae8
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strnlen-power7.S
|
|
|
ce426f |
@@ -0,0 +1,40 @@
|
|
|
ce426f |
+/* Optimized strnlen version for 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 ENTRY
|
|
|
ce426f |
+#define ENTRY(name) \
|
|
|
ce426f |
+ .section ".text"; \
|
|
|
ce426f |
+ ENTRY_2(__strnlen_power7) \
|
|
|
ce426f |
+ .align ALIGNARG(2); \
|
|
|
ce426f |
+ BODY_LABEL(__strnlen_power7): \
|
|
|
ce426f |
+ cfi_startproc;
|
|
|
ce426f |
+
|
|
|
ce426f |
+#undef END
|
|
|
ce426f |
+#define END(name) \
|
|
|
ce426f |
+ cfi_endproc; \
|
|
|
ce426f |
+ TRACEBACK(__strnlen_power7) \
|
|
|
ce426f |
+ END_2(__strnlen_power7)
|
|
|
ce426f |
+
|
|
|
ce426f |
+#undef libc_hidden_builtin_def
|
|
|
ce426f |
+#define libc_hidden_builtin_def(name)
|
|
|
ce426f |
+#undef weak_alias
|
|
|
ce426f |
+#define weak_alias(name, alias)
|
|
|
ce426f |
+
|
|
|
ce426f |
+#include <sysdeps/powerpc/powerpc64/power7/strnlen.S>
|
|
|
ce426f |
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strnlen-ppc64.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strnlen-ppc64.c
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..9d23994
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strnlen-ppc64.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/powerpc32/power4/multiarch/strnlen-ppc32.c>
|
|
|
ce426f |
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strnlen.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strnlen.c
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..3926031
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strnlen.c
|
|
|
ce426f |
@@ -0,0 +1,36 @@
|
|
|
ce426f |
+/* Multiple versions of strnlen.
|
|
|
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 |
+#ifndef NOT_IN_libc
|
|
|
ce426f |
+# include <string.h>
|
|
|
ce426f |
+# include <shlib-compat.h>
|
|
|
ce426f |
+# include "init-arch.h"
|
|
|
ce426f |
+
|
|
|
ce426f |
+extern __typeof (__strnlen) __strnlen_ppc attribute_hidden;
|
|
|
ce426f |
+extern __typeof (__strnlen) __strnlen_power7 attribute_hidden;
|
|
|
ce426f |
+
|
|
|
ce426f |
+libc_ifunc (__strnlen,
|
|
|
ce426f |
+ (hwcap & PPC_FEATURE_HAS_VSX)
|
|
|
ce426f |
+ ? __strnlen_power7
|
|
|
ce426f |
+ : __strnlen_ppc);
|
|
|
ce426f |
+weak_alias (__strnlen, strnlen)
|
|
|
ce426f |
+libc_hidden_def (strnlen)
|
|
|
ce426f |
+
|
|
|
ce426f |
+#else
|
|
|
ce426f |
+#include <string/strnlen.c>
|
|
|
ce426f |
+#endif
|
|
|
ce426f |
--
|
|
|
ce426f |
1.8.3.1
|
|
|
ce426f |
|