|
|
bdc76f |
commit 25218822bdbfb49b8ea0f419e8a20d2b9bd47cd0
|
|
|
bdc76f |
Author: Stefan Liebler <stli@linux.ibm.com>
|
|
|
bdc76f |
Date: Tue Dec 18 13:57:11 2018 +0100
|
|
|
bdc76f |
|
|
|
bdc76f |
S390: Refactor stpncpy ifunc handling.
|
|
|
bdc76f |
|
|
|
bdc76f |
The ifunc handling for stpncpy is adjusted in order to omit ifunc
|
|
|
bdc76f |
variants if those will never be used as the minimum architecture level
|
|
|
bdc76f |
already supports newer CPUs by default.
|
|
|
bdc76f |
Glibc internal calls will then also use the "newer" ifunc variant.
|
|
|
bdc76f |
|
|
|
bdc76f |
ChangeLog:
|
|
|
bdc76f |
|
|
|
bdc76f |
* sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
(sysdep_routines): Remove stpncpy variants.
|
|
|
bdc76f |
* sysdeps/s390/Makefile (sysdep_routines): Add stpncpy variants.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
(__libc_ifunc_impl_list): Refactor ifunc handling for stpncpy.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/stpncpy-c.c: Move to ...
|
|
|
bdc76f |
* sysdeps/s390/stpncpy-c.c: ... here and adjust ifunc handling.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/stpncpy-vx.S: Move to ...
|
|
|
bdc76f |
* sysdeps/s390/stpncpy-vx.S: ... here and adjust ifunc handling.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/stpncpy.c: Move to ...
|
|
|
bdc76f |
* sysdeps/s390/stpncpy.c: ... here and adjust ifunc handling.
|
|
|
bdc76f |
* sysdeps/s390/ifunc-stpncpy.h: New file.
|
|
|
bdc76f |
|
|
|
bdc76f |
diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
|
|
|
bdc76f |
index db060c81aade84ca..a9882b3996c30322 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/Makefile
|
|
|
bdc76f |
+++ b/sysdeps/s390/Makefile
|
|
|
bdc76f |
@@ -41,5 +41,6 @@ sysdep_routines += bzero memset memset-z900 \
|
|
|
bdc76f |
strnlen strnlen-vx strnlen-c \
|
|
|
bdc76f |
strcpy strcpy-vx strcpy-z900 \
|
|
|
bdc76f |
stpcpy stpcpy-vx stpcpy-c \
|
|
|
bdc76f |
- strncpy strncpy-vx strncpy-z900
|
|
|
bdc76f |
+ strncpy strncpy-vx strncpy-z900 \
|
|
|
bdc76f |
+ stpncpy stpncpy-vx stpncpy-c
|
|
|
bdc76f |
endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/ifunc-stpncpy.h b/sysdeps/s390/ifunc-stpncpy.h
|
|
|
bdc76f |
new file mode 100644
|
|
|
bdc76f |
index 0000000000000000..46e57334e8439c1c
|
|
|
bdc76f |
--- /dev/null
|
|
|
bdc76f |
+++ b/sysdeps/s390/ifunc-stpncpy.h
|
|
|
bdc76f |
@@ -0,0 +1,52 @@
|
|
|
bdc76f |
+/* stpncpy 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_STPNCPY_IFUNC 1
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define HAVE_STPNCPY_IFUNC 0
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#ifdef HAVE_S390_VX_ASM_SUPPORT
|
|
|
bdc76f |
+# define HAVE_STPNCPY_IFUNC_AND_VX_SUPPORT HAVE_STPNCPY_IFUNC
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define HAVE_STPNCPY_IFUNC_AND_VX_SUPPORT 0
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if defined HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT
|
|
|
bdc76f |
+# define STPNCPY_DEFAULT STPNCPY_Z13
|
|
|
bdc76f |
+# define HAVE_STPNCPY_C 0
|
|
|
bdc76f |
+# define HAVE_STPNCPY_Z13 1
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define STPNCPY_DEFAULT STPNCPY_C
|
|
|
bdc76f |
+# define HAVE_STPNCPY_C 1
|
|
|
bdc76f |
+# define HAVE_STPNCPY_Z13 HAVE_STPNCPY_IFUNC_AND_VX_SUPPORT
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_STPNCPY_C
|
|
|
bdc76f |
+# define STPNCPY_C __stpncpy_c
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define STPNCPY_C NULL
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_STPNCPY_Z13
|
|
|
bdc76f |
+# define STPNCPY_Z13 __stpncpy_vx
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define STPNCPY_Z13 NULL
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/Makefile b/sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
index c5189b556cf3762d..3d97d21da1fc852b 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
+++ b/sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
@@ -1,6 +1,5 @@
|
|
|
bdc76f |
ifeq ($(subdir),string)
|
|
|
bdc76f |
-sysdep_routines += stpncpy stpncpy-vx stpncpy-c \
|
|
|
bdc76f |
- strcat strcat-vx strcat-c \
|
|
|
bdc76f |
+sysdep_routines += strcat strcat-vx strcat-c \
|
|
|
bdc76f |
strncat strncat-vx strncat-c \
|
|
|
bdc76f |
strcmp strcmp-vx \
|
|
|
bdc76f |
strncmp strncmp-vx strncmp-c \
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
index d598fc5c22050da2..021e9f247fff44df 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
+++ b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
@@ -31,6 +31,7 @@
|
|
|
bdc76f |
#include <ifunc-strcpy.h>
|
|
|
bdc76f |
#include <ifunc-stpcpy.h>
|
|
|
bdc76f |
#include <ifunc-strncpy.h>
|
|
|
bdc76f |
+#include <ifunc-stpncpy.h>
|
|
|
bdc76f |
|
|
|
bdc76f |
/* Maximum number of IFUNC implementations. */
|
|
|
bdc76f |
#define MAX_IFUNC 3
|
|
|
bdc76f |
@@ -229,6 +230,18 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
bdc76f |
)
|
|
|
bdc76f |
#endif /* HAVE_STRNCPY_IFUNC */
|
|
|
bdc76f |
|
|
|
bdc76f |
+#if HAVE_STPNCPY_IFUNC
|
|
|
bdc76f |
+ IFUNC_IMPL (i, name, stpncpy,
|
|
|
bdc76f |
+# if HAVE_STPNCPY_Z13
|
|
|
bdc76f |
+ IFUNC_IMPL_ADD (array, i, stpncpy,
|
|
|
bdc76f |
+ dl_hwcap & HWCAP_S390_VX, STPNCPY_Z13)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+# if HAVE_STPNCPY_C
|
|
|
bdc76f |
+ IFUNC_IMPL_ADD (array, i, stpncpy, 1, STPNCPY_C)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+ )
|
|
|
bdc76f |
+#endif /* HAVE_STPNCPY_IFUNC */
|
|
|
bdc76f |
+
|
|
|
bdc76f |
|
|
|
bdc76f |
#ifdef HAVE_S390_VX_ASM_SUPPORT
|
|
|
bdc76f |
|
|
|
bdc76f |
@@ -248,7 +261,6 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
bdc76f |
|
|
|
bdc76f |
IFUNC_VX_IMPL (wcsncpy);
|
|
|
bdc76f |
|
|
|
bdc76f |
- IFUNC_VX_IMPL (stpncpy);
|
|
|
bdc76f |
IFUNC_VX_IMPL (wcpncpy);
|
|
|
bdc76f |
|
|
|
bdc76f |
IFUNC_VX_IMPL (strcat);
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/stpncpy-c.c b/sysdeps/s390/stpncpy-c.c
|
|
|
bdc76f |
similarity index 74%
|
|
|
bdc76f |
rename from sysdeps/s390/multiarch/stpncpy-c.c
|
|
|
bdc76f |
rename to sysdeps/s390/stpncpy-c.c
|
|
|
bdc76f |
index 45e50aa9e7df0b5e..e5d1ae867562da6c 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/stpncpy-c.c
|
|
|
bdc76f |
+++ b/sysdeps/s390/stpncpy-c.c
|
|
|
bdc76f |
@@ -16,13 +16,18 @@
|
|
|
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 STPNCPY __stpncpy_c
|
|
|
bdc76f |
-# ifdef SHARED
|
|
|
bdc76f |
-# undef libc_hidden_def
|
|
|
bdc76f |
-# define libc_hidden_def(name) \
|
|
|
bdc76f |
- __hidden_ver1 (__stpncpy_c, __GI___stpncpy, __stpncpy_c);
|
|
|
bdc76f |
-# endif /* SHARED */
|
|
|
bdc76f |
+#include <ifunc-stpncpy.h>
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_STPNCPY_C
|
|
|
bdc76f |
+# if HAVE_STPNCPY_IFUNC
|
|
|
bdc76f |
+# define STPNCPY STPNCPY_C
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+# if defined SHARED && IS_IN (libc)
|
|
|
bdc76f |
+# undef libc_hidden_def
|
|
|
bdc76f |
+# define libc_hidden_def(name) \
|
|
|
bdc76f |
+ __hidden_ver1 (__stpncpy_c, __GI___stpncpy, __stpncpy_c);
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
|
|
|
bdc76f |
# include <string/stpncpy.c>
|
|
|
bdc76f |
-#endif /* HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) */
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/stpncpy-vx.S b/sysdeps/s390/stpncpy-vx.S
|
|
|
bdc76f |
similarity index 95%
|
|
|
bdc76f |
rename from sysdeps/s390/multiarch/stpncpy-vx.S
|
|
|
bdc76f |
rename to sysdeps/s390/stpncpy-vx.S
|
|
|
bdc76f |
index 922bd7a355a2d8a0..3dccc10be3b58d8d 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/stpncpy-vx.S
|
|
|
bdc76f |
+++ b/sysdeps/s390/stpncpy-vx.S
|
|
|
bdc76f |
@@ -16,7 +16,9 @@
|
|
|
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-stpncpy.h>
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_STPNCPY_Z13
|
|
|
bdc76f |
|
|
|
bdc76f |
# include "sysdep.h"
|
|
|
bdc76f |
# include "asm-syntax.h"
|
|
|
bdc76f |
@@ -38,7 +40,7 @@
|
|
|
bdc76f |
-%r6 = loaded bytes
|
|
|
bdc76f |
-%r7 = border, tmp
|
|
|
bdc76f |
*/
|
|
|
bdc76f |
-ENTRY(__stpncpy_vx)
|
|
|
bdc76f |
+ENTRY(STPNCPY_Z13)
|
|
|
bdc76f |
.machine "z13"
|
|
|
bdc76f |
.machinemode "zarch_nohighgprs"
|
|
|
bdc76f |
|
|
|
bdc76f |
@@ -196,5 +198,14 @@ ENTRY(__stpncpy_vx)
|
|
|
bdc76f |
|
|
|
bdc76f |
vl %v16,0(%r5,%r3) /* Load s. */
|
|
|
bdc76f |
j .Llt64
|
|
|
bdc76f |
-END(__stpncpy_vx)
|
|
|
bdc76f |
-#endif /* HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) */
|
|
|
bdc76f |
+END(STPNCPY_Z13)
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+# if ! HAVE_STPNCPY_IFUNC
|
|
|
bdc76f |
+strong_alias (STPNCPY_Z13, __stpncpy)
|
|
|
bdc76f |
+weak_alias (__stpncpy, stpncpy)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+# if ! HAVE_STPNCPY_C && defined SHARED && IS_IN (libc)
|
|
|
bdc76f |
+strong_alias (STPNCPY_Z13, __GI___stpncpy)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/stpncpy.c b/sysdeps/s390/stpncpy.c
|
|
|
bdc76f |
similarity index 70%
|
|
|
bdc76f |
rename from sysdeps/s390/multiarch/stpncpy.c
|
|
|
bdc76f |
rename to sysdeps/s390/stpncpy.c
|
|
|
bdc76f |
index f7f9d51a50db47d7..250dc68ed19bf6d9 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/stpncpy.c
|
|
|
bdc76f |
+++ b/sysdeps/s390/stpncpy.c
|
|
|
bdc76f |
@@ -16,7 +16,9 @@
|
|
|
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-stpncpy.h>
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_STPNCPY_IFUNC
|
|
|
bdc76f |
# define stpncpy __redirect_stpncpy
|
|
|
bdc76f |
# define __stpncpy __redirect___stpncpy
|
|
|
bdc76f |
# include <string.h>
|
|
|
bdc76f |
@@ -24,9 +26,18 @@
|
|
|
bdc76f |
# undef __stpncpy
|
|
|
bdc76f |
# include <ifunc-resolve.h>
|
|
|
bdc76f |
|
|
|
bdc76f |
-s390_vx_libc_ifunc_redirected (__redirect___stpncpy, __stpncpy)
|
|
|
bdc76f |
-weak_alias (__stpncpy, stpncpy)
|
|
|
bdc76f |
+# if HAVE_STPNCPY_C
|
|
|
bdc76f |
+extern __typeof (__redirect_stpncpy) STPNCPY_C attribute_hidden;
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
|
|
|
bdc76f |
-#else
|
|
|
bdc76f |
-# include <string/stpncpy.c>
|
|
|
bdc76f |
-#endif /* !(defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)) */
|
|
|
bdc76f |
+# if HAVE_STPNCPY_Z13
|
|
|
bdc76f |
+extern __typeof (__redirect_stpncpy) STPNCPY_Z13 attribute_hidden;
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+s390_libc_ifunc_expr (__redirect___stpncpy, __stpncpy,
|
|
|
bdc76f |
+ (HAVE_STPNCPY_Z13 && (hwcap & HWCAP_S390_VX))
|
|
|
bdc76f |
+ ? STPNCPY_Z13
|
|
|
bdc76f |
+ : STPNCPY_DEFAULT
|
|
|
bdc76f |
+ )
|
|
|
bdc76f |
+weak_alias (__stpncpy, stpncpy)
|
|
|
bdc76f |
+#endif
|