|
|
bdc76f |
commit 2e02d0b7a9bf3421638d2d0f2526275a1df5c0da
|
|
|
bdc76f |
Author: Stefan Liebler <stli@linux.ibm.com>
|
|
|
bdc76f |
Date: Tue Dec 18 13:57:17 2018 +0100
|
|
|
bdc76f |
|
|
|
bdc76f |
S390: Refactor wcslen ifunc handling.
|
|
|
bdc76f |
|
|
|
bdc76f |
The ifunc handling for wcslen is adjusted in order to omit ifunc
|
|
|
bdc76f |
if the minimum architecture level already supports newer CPUs by default.
|
|
|
bdc76f |
Unfortunately the c ifunc variant can't be omitted at all as it is used
|
|
|
bdc76f |
by the z13 ifunc variant as fallback if the pointers are not 4-byte aligned.
|
|
|
bdc76f |
|
|
|
bdc76f |
ChangeLog:
|
|
|
bdc76f |
|
|
|
bdc76f |
* sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
(sysdep_routines): Remove wcslen variants.
|
|
|
bdc76f |
* sysdeps/s390/Makefile (sysdep_routines): Add wcslen variants.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
(__libc_ifunc_impl_list): Refactor ifunc handling for wcslen.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/wcslen-c.c: Move to ...
|
|
|
bdc76f |
* sysdeps/s390/wcslen-c.c: ... here and adjust ifunc handling.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/wcslen-vx.S: Move to ...
|
|
|
bdc76f |
* sysdeps/s390/wcslen-vx.S: ... here and adjust ifunc handling.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/wcslen.c: Move to ...
|
|
|
bdc76f |
* sysdeps/s390/wcslen.c: ... here and adjust ifunc handling.
|
|
|
bdc76f |
* sysdeps/s390/ifunc-wcslen.h: New file.
|
|
|
bdc76f |
|
|
|
bdc76f |
diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
|
|
|
bdc76f |
index 9a16ce1692e51607..65e89118936bb668 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/Makefile
|
|
|
bdc76f |
+++ b/sysdeps/s390/Makefile
|
|
|
bdc76f |
@@ -58,3 +58,7 @@ sysdep_routines += bzero memset memset-z900 \
|
|
|
bdc76f |
memccpy memccpy-vx memccpy-c \
|
|
|
bdc76f |
memrchr memrchr-vx memrchr-c
|
|
|
bdc76f |
endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+ifeq ($(subdir),wcsmbs)
|
|
|
bdc76f |
+sysdep_routines += wcslen wcslen-vx wcslen-c
|
|
|
bdc76f |
+endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/ifunc-wcslen.h b/sysdeps/s390/ifunc-wcslen.h
|
|
|
bdc76f |
new file mode 100644
|
|
|
bdc76f |
index 0000000000000000..50d879caf2b8186b
|
|
|
bdc76f |
--- /dev/null
|
|
|
bdc76f |
+++ b/sysdeps/s390/ifunc-wcslen.h
|
|
|
bdc76f |
@@ -0,0 +1,53 @@
|
|
|
bdc76f |
+/* wcslen variant information on S/390 version.
|
|
|
bdc76f |
+ Copyright (C) 2018 Free Software Foundation, Inc.
|
|
|
bdc76f |
+ This file is part of the GNU C Library.
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
bdc76f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
bdc76f |
+ License as published by the Free Software Foundation; either
|
|
|
bdc76f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
bdc76f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
bdc76f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
bdc76f |
+ Lesser General Public License for more details.
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
bdc76f |
+ License along with the GNU C Library; if not, see
|
|
|
bdc76f |
+ <http://www.gnu.org/licenses/>. */
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if defined USE_MULTIARCH && IS_IN (libc) \
|
|
|
bdc76f |
+ && ! defined HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT
|
|
|
bdc76f |
+# define HAVE_WCSLEN_IFUNC 1
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define HAVE_WCSLEN_IFUNC 0
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#ifdef HAVE_S390_VX_ASM_SUPPORT
|
|
|
bdc76f |
+# define HAVE_WCSLEN_IFUNC_AND_VX_SUPPORT HAVE_WCSLEN_IFUNC
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define HAVE_WCSLEN_IFUNC_AND_VX_SUPPORT 0
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if defined HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT
|
|
|
bdc76f |
+# define WCSLEN_DEFAULT WCSLEN_Z13
|
|
|
bdc76f |
+/* The z13 ifunc variant is using the common code variant as fallback! */
|
|
|
bdc76f |
+# define HAVE_WCSLEN_C 1
|
|
|
bdc76f |
+# define HAVE_WCSLEN_Z13 1
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define WCSLEN_DEFAULT WCSLEN_C
|
|
|
bdc76f |
+# define HAVE_WCSLEN_C 1
|
|
|
bdc76f |
+# define HAVE_WCSLEN_Z13 HAVE_WCSLEN_IFUNC_AND_VX_SUPPORT
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_WCSLEN_C
|
|
|
bdc76f |
+# define WCSLEN_C __wcslen_c
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define WCSLEN_C NULL
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_WCSLEN_Z13
|
|
|
bdc76f |
+# define WCSLEN_Z13 __wcslen_vx
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define WCSLEN_Z13 NULL
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/Makefile b/sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
index 260b514936b93306..421d40d020b81560 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
+++ b/sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
@@ -1,6 +1,5 @@
|
|
|
bdc76f |
ifeq ($(subdir),wcsmbs)
|
|
|
bdc76f |
-sysdep_routines += wcslen wcslen-vx wcslen-c \
|
|
|
bdc76f |
- wcsnlen wcsnlen-vx wcsnlen-c \
|
|
|
bdc76f |
+sysdep_routines += wcsnlen wcsnlen-vx wcsnlen-c \
|
|
|
bdc76f |
wcscpy wcscpy-vx wcscpy-c \
|
|
|
bdc76f |
wcpcpy wcpcpy-vx wcpcpy-c \
|
|
|
bdc76f |
wcsncpy wcsncpy-vx wcsncpy-c \
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
index 0f01b99691002be0..7bf5f14c015b54fe 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
+++ b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
@@ -46,6 +46,7 @@
|
|
|
bdc76f |
#include <ifunc-rawmemchr.h>
|
|
|
bdc76f |
#include <ifunc-memccpy.h>
|
|
|
bdc76f |
#include <ifunc-memrchr.h>
|
|
|
bdc76f |
+#include <ifunc-wcslen.h>
|
|
|
bdc76f |
|
|
|
bdc76f |
/* Maximum number of IFUNC implementations. */
|
|
|
bdc76f |
#define MAX_IFUNC 3
|
|
|
bdc76f |
@@ -424,6 +425,18 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
bdc76f |
)
|
|
|
bdc76f |
#endif /* HAVE_MEMRCHR_IFUNC */
|
|
|
bdc76f |
|
|
|
bdc76f |
+#if HAVE_WCSLEN_IFUNC
|
|
|
bdc76f |
+ IFUNC_IMPL (i, name, wcslen,
|
|
|
bdc76f |
+# if HAVE_WCSLEN_Z13
|
|
|
bdc76f |
+ IFUNC_IMPL_ADD (array, i, wcslen,
|
|
|
bdc76f |
+ dl_hwcap & HWCAP_S390_VX, WCSLEN_Z13)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+# if HAVE_WCSLEN_C
|
|
|
bdc76f |
+ IFUNC_IMPL_ADD (array, i, wcslen, 1, WCSLEN_C)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+ )
|
|
|
bdc76f |
+#endif /* HAVE_WCSLEN_IFUNC */
|
|
|
bdc76f |
+
|
|
|
bdc76f |
#ifdef HAVE_S390_VX_ASM_SUPPORT
|
|
|
bdc76f |
|
|
|
bdc76f |
# define IFUNC_VX_IMPL(FUNC) \
|
|
|
bdc76f |
@@ -432,8 +445,6 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
bdc76f |
__##FUNC##_vx) \
|
|
|
bdc76f |
IFUNC_IMPL_ADD (array, i, FUNC, 1, __##FUNC##_c))
|
|
|
bdc76f |
|
|
|
bdc76f |
- IFUNC_VX_IMPL (wcslen);
|
|
|
bdc76f |
-
|
|
|
bdc76f |
IFUNC_VX_IMPL (wcsnlen);
|
|
|
bdc76f |
|
|
|
bdc76f |
IFUNC_VX_IMPL (wcscpy);
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/wcslen-c.c b/sysdeps/s390/wcslen-c.c
|
|
|
bdc76f |
similarity index 86%
|
|
|
bdc76f |
rename from sysdeps/s390/multiarch/wcslen-c.c
|
|
|
bdc76f |
rename to sysdeps/s390/wcslen-c.c
|
|
|
bdc76f |
index 32a23e206d2e9cf9..45399cff3a127b5e 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/wcslen-c.c
|
|
|
bdc76f |
+++ b/sysdeps/s390/wcslen-c.c
|
|
|
bdc76f |
@@ -16,10 +16,12 @@
|
|
|
bdc76f |
License along with the GNU C Library; if not, see
|
|
|
bdc76f |
<http://www.gnu.org/licenses/>. */
|
|
|
bdc76f |
|
|
|
bdc76f |
-#if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
|
|
|
bdc76f |
-# define WCSLEN __wcslen_c
|
|
|
bdc76f |
+#include <ifunc-wcslen.h>
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_WCSLEN_C
|
|
|
bdc76f |
+# if HAVE_WCSLEN_IFUNC || HAVE_WCSLEN_Z13
|
|
|
bdc76f |
+# define WCSLEN WCSLEN_C
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
|
|
|
bdc76f |
-# include <wchar.h>
|
|
|
bdc76f |
-extern __typeof (__wcslen) __wcslen_c;
|
|
|
bdc76f |
# include <wcsmbs/wcslen.c>
|
|
|
bdc76f |
#endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/wcslen-vx.S b/sysdeps/s390/wcslen-vx.S
|
|
|
bdc76f |
similarity index 92%
|
|
|
bdc76f |
rename from sysdeps/s390/multiarch/wcslen-vx.S
|
|
|
bdc76f |
rename to sysdeps/s390/wcslen-vx.S
|
|
|
bdc76f |
index 337cbed6ec21db76..114f7ef743b10c63 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/wcslen-vx.S
|
|
|
bdc76f |
+++ b/sysdeps/s390/wcslen-vx.S
|
|
|
bdc76f |
@@ -16,7 +16,8 @@
|
|
|
bdc76f |
License along with the GNU C Library; if not, see
|
|
|
bdc76f |
<http://www.gnu.org/licenses/>. */
|
|
|
bdc76f |
|
|
|
bdc76f |
-#if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
|
|
|
bdc76f |
+#include <ifunc-wcslen.h>
|
|
|
bdc76f |
+#if HAVE_WCSLEN_Z13
|
|
|
bdc76f |
|
|
|
bdc76f |
# include "sysdep.h"
|
|
|
bdc76f |
# include "asm-syntax.h"
|
|
|
bdc76f |
@@ -34,7 +35,7 @@
|
|
|
bdc76f |
-r5=current_len and return_value
|
|
|
bdc76f |
-v16=part of s
|
|
|
bdc76f |
*/
|
|
|
bdc76f |
-ENTRY(__wcslen_vx)
|
|
|
bdc76f |
+ENTRY(WCSLEN_Z13)
|
|
|
bdc76f |
.machine "z13"
|
|
|
bdc76f |
.machinemode "zarch_nohighgprs"
|
|
|
bdc76f |
|
|
|
bdc76f |
@@ -86,6 +87,11 @@ ENTRY(__wcslen_vx)
|
|
|
bdc76f |
srlg %r2,%r2,2 /* Convert byte-count to character-count. */
|
|
|
bdc76f |
br %r14
|
|
|
bdc76f |
.Lfallback:
|
|
|
bdc76f |
- jg __wcslen_c
|
|
|
bdc76f |
-END(__wcslen_vx)
|
|
|
bdc76f |
-#endif /* HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) */
|
|
|
bdc76f |
+ jg WCSLEN_C
|
|
|
bdc76f |
+END(WCSLEN_Z13)
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+# if ! HAVE_WCSLEN_IFUNC
|
|
|
bdc76f |
+strong_alias (WCSLEN_Z13, __wcslen)
|
|
|
bdc76f |
+weak_alias (__wcslen, wcslen)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/wcslen.c b/sysdeps/s390/wcslen.c
|
|
|
bdc76f |
similarity index 70%
|
|
|
bdc76f |
rename from sysdeps/s390/multiarch/wcslen.c
|
|
|
bdc76f |
rename to sysdeps/s390/wcslen.c
|
|
|
bdc76f |
index 3a1d1a32c9a99749..a5eee83f6cae7166 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/wcslen.c
|
|
|
bdc76f |
+++ b/sysdeps/s390/wcslen.c
|
|
|
bdc76f |
@@ -16,13 +16,24 @@
|
|
|
bdc76f |
License along with the GNU C Library; if not, see
|
|
|
bdc76f |
<http://www.gnu.org/licenses/>. */
|
|
|
bdc76f |
|
|
|
bdc76f |
-#if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
|
|
|
bdc76f |
+#include <ifunc-wcslen.h>
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_WCSLEN_IFUNC
|
|
|
bdc76f |
# include <wchar.h>
|
|
|
bdc76f |
# include <ifunc-resolve.h>
|
|
|
bdc76f |
|
|
|
bdc76f |
-s390_vx_libc_ifunc (__wcslen)
|
|
|
bdc76f |
-weak_alias (__wcslen, wcslen)
|
|
|
bdc76f |
+# if HAVE_WCSLEN_C
|
|
|
bdc76f |
+extern __typeof (__wcslen) WCSLEN_C attribute_hidden;
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
|
|
|
bdc76f |
-#else
|
|
|
bdc76f |
-# include <wcsmbs/wcslen.c>
|
|
|
bdc76f |
-#endif /* !(defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)) */
|
|
|
bdc76f |
+# if HAVE_WCSLEN_Z13
|
|
|
bdc76f |
+extern __typeof (__wcslen) WCSLEN_Z13 attribute_hidden;
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+s390_libc_ifunc_expr (__wcslen, __wcslen,
|
|
|
bdc76f |
+ (HAVE_WCSLEN_Z13 && (hwcap & HWCAP_S390_VX))
|
|
|
bdc76f |
+ ? WCSLEN_Z13
|
|
|
bdc76f |
+ : WCSLEN_DEFAULT
|
|
|
bdc76f |
+ )
|
|
|
bdc76f |
+weak_alias (__wcslen, wcslen)
|
|
|
bdc76f |
+#endif
|