d8307d
commit 712a254a97ade7f48fb7a434339faa05c048ce1f
d8307d
Author: Stefan Liebler <stli@linux.ibm.com>
d8307d
Date:   Tue Dec 18 13:57:04 2018 +0100
d8307d
d8307d
    S390: Refactor memset ifunc handling.
d8307d
    
d8307d
    This patch moves all ifunc variants for memset
d8307d
    to sysdeps/s390/memset-z900.S. The configure-check/preprocessor logic
d8307d
    in sysdeps/s390/ifunc-memset.h decides if ifunc is needed at all
d8307d
    and which ifunc variants should be available.
d8307d
    E.g. if the compiler/assembler already supports z196 by default,
d8307d
    the older ifunc variants are not included.
d8307d
    If we only need the newest ifunc variant,
d8307d
    then we can skip ifunc at all.
d8307d
    
d8307d
    Therefore the ifunc-resolvers and __libc_ifunc_impl_list are adjusted
d8307d
    in order to handle only the available ifunc variants.
d8307d
    
d8307d
    ChangeLog:
d8307d
    
d8307d
            * sysdeps/s390/ifunc-memset.h: New File.
d8307d
            * sysdeps/s390/memset.S: Move to ...
d8307d
            * sysdeps/s390/memset-z900.S ... here.
d8307d
            Move implementations from memset-s390x.s to here.
d8307d
            * sysdeps/s390/multiarch/memset-s390x.S: Delete File.
d8307d
            * sysdeps/s390/multiarch/Makefile (sysdep_routines):
d8307d
            Remove memset variants.
d8307d
            * sysdeps/s390/Makefile (sysdep_routines):
d8307d
            Add memset variants.
d8307d
            * sysdeps/s390/multiarch/ifunc-impl-list.c
d8307d
            (__libc_ifunc_impl_list): Adjust ifunc variants for
d8307d
            memset.
d8307d
            * sysdeps/s390/multiarch/memset.c: Move ifunc resolver
d8307d
            to ...
d8307d
            * sysdeps/s390/memset.c: ... here.
d8307d
            Adjust ifunc variants for memset.
d8307d
d8307d
Conflicts:
d8307d
	sysdeps/s390/Makefile
d8307d
	  Missing backport of commit 69e2444ab1444ab8210598abbcb4822701d368b9
d8307d
          ("S390: Test that lazy binding does not clobber R0").
d8307d
d8307d
diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
d8307d
index 8a54f88cd7ac880e..360838e172f4ca37 100644
d8307d
--- a/sysdeps/s390/Makefile
d8307d
+++ b/sysdeps/s390/Makefile
d8307d
@@ -29,3 +29,7 @@ $(inst_gconvdir)/%.so: $(objpfx)%.so $(+force)
d8307d
 
d8307d
 sysdeps-gconv-modules = ../sysdeps/s390/gconv-modules
d8307d
 endif
d8307d
+
d8307d
+ifeq ($(subdir),string)
d8307d
+sysdep_routines += memset memset-z900
d8307d
+endif
d8307d
diff --git a/sysdeps/s390/ifunc-memset.h b/sysdeps/s390/ifunc-memset.h
d8307d
new file mode 100644
d8307d
index 0000000000000000..9a13b1001fed9979
d8307d
--- /dev/null
d8307d
+++ b/sysdeps/s390/ifunc-memset.h
d8307d
@@ -0,0 +1,65 @@
d8307d
+/* memset variant information on S/390 version.
d8307d
+   Copyright (C) 2018 Free Software Foundation, Inc.
d8307d
+   This file is part of the GNU C Library.
d8307d
+
d8307d
+   The GNU C Library is free software; you can redistribute it and/or
d8307d
+   modify it under the terms of the GNU Lesser General Public
d8307d
+   License as published by the Free Software Foundation; either
d8307d
+   version 2.1 of the License, or (at your option) any later version.
d8307d
+
d8307d
+   The GNU C Library is distributed in the hope that it will be useful,
d8307d
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
d8307d
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
d8307d
+   Lesser General Public License for more details.
d8307d
+
d8307d
+   You should have received a copy of the GNU Lesser General Public
d8307d
+   License along with the GNU C Library; if not, see
d8307d
+   <http://www.gnu.org/licenses/>.  */
d8307d
+
d8307d
+#if defined USE_MULTIARCH && IS_IN (libc)	\
d8307d
+  && ! defined HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
d8307d
+# define HAVE_MEMSET_IFUNC	1
d8307d
+#else
d8307d
+# define HAVE_MEMSET_IFUNC	0
d8307d
+#endif
d8307d
+
d8307d
+#if defined HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
d8307d
+# define MEMSET_DEFAULT		MEMSET_Z196
d8307d
+# define HAVE_MEMSET_Z900_G5	0
d8307d
+# define HAVE_MEMSET_Z10	0
d8307d
+# define HAVE_MEMSET_Z196	1
d8307d
+#elif defined HAVE_S390_MIN_Z10_ZARCH_ASM_SUPPORT
d8307d
+# define MEMSET_DEFAULT		MEMSET_Z10
d8307d
+# define HAVE_MEMSET_Z900_G5	0
d8307d
+# define HAVE_MEMSET_Z10	1
d8307d
+# define HAVE_MEMSET_Z196	HAVE_MEMSET_IFUNC
d8307d
+#else
d8307d
+# define MEMSET_DEFAULT		MEMSET_Z900_G5
d8307d
+# define HAVE_MEMSET_Z900_G5	1
d8307d
+# define HAVE_MEMSET_Z10	HAVE_MEMSET_IFUNC
d8307d
+# define HAVE_MEMSET_Z196	HAVE_MEMSET_IFUNC
d8307d
+#endif
d8307d
+
d8307d
+#if HAVE_MEMSET_Z10 || HAVE_MEMSET_Z196
d8307d
+# define HAVE_MEMSET_MVCLE	1
d8307d
+#else
d8307d
+# define HAVE_MEMSET_MVCLE	0
d8307d
+#endif
d8307d
+
d8307d
+#if HAVE_MEMSET_Z900_G5
d8307d
+# define MEMSET_Z900_G5		__memset_default
d8307d
+#else
d8307d
+# define MEMSET_Z900_G5		NULL
d8307d
+#endif
d8307d
+
d8307d
+#if HAVE_MEMSET_Z10
d8307d
+# define MEMSET_Z10		__memset_z10
d8307d
+#else
d8307d
+# define MEMSET_Z10		NULL
d8307d
+#endif
d8307d
+
d8307d
+#if HAVE_MEMSET_Z196
d8307d
+# define MEMSET_Z196		__memset_z196
d8307d
+#else
d8307d
+# define MEMSET_Z196		NULL
d8307d
+#endif
d8307d
diff --git a/sysdeps/s390/multiarch/memset-s390x.S b/sysdeps/s390/memset-z900.S
d8307d
similarity index 57%
d8307d
rename from sysdeps/s390/multiarch/memset-s390x.S
d8307d
rename to sysdeps/s390/memset-z900.S
d8307d
index aca3ac3fda1dd228..eaf13402bd3e251d 100644
d8307d
--- a/sysdeps/s390/multiarch/memset-s390x.S
d8307d
+++ b/sysdeps/s390/memset-z900.S
d8307d
@@ -1,5 +1,6 @@
d8307d
 /* Set a block of memory to some byte value.  31/64 bit S/390 version.
d8307d
-   Copyright (C) 2012-2018 Free Software Foundation, Inc.
d8307d
+   Copyright (C) 2001-2018 Free Software Foundation, Inc.
d8307d
+   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
d8307d
    This file is part of the GNU C Library.
d8307d
 
d8307d
    The GNU C Library is free software; you can redistribute it and/or
d8307d
@@ -17,8 +18,9 @@
d8307d
    <http://www.gnu.org/licenses/>.  */
d8307d
 
d8307d
 
d8307d
-#include "sysdep.h"
d8307d
+#include <sysdep.h>
d8307d
 #include "asm-syntax.h"
d8307d
+#include <ifunc-memset.h>
d8307d
 
d8307d
 /* INPUT PARAMETERS
d8307d
      %r2 = address of memory area
d8307d
@@ -27,43 +29,68 @@
d8307d
 
d8307d
        .text
d8307d
 
d8307d
-#if IS_IN (libc)
d8307d
+#if HAVE_MEMSET_Z900_G5
d8307d
+# if defined __s390x__
d8307d
+#  define LTGR	ltgr
d8307d
+#  define CGHI	cghi
d8307d
+#  define LGR	lgr
d8307d
+#  define AGHI	aghi
d8307d
+#  define BRCTG	brctg
d8307d
+# else
d8307d
+#  define LTGR	ltr
d8307d
+#  define CGHI	chi
d8307d
+#  define LGR	lr
d8307d
+#  define AGHI	ahi
d8307d
+#  define BRCTG	brct
d8307d
+# endif /* ! defined __s390x__  */
d8307d
 
d8307d
-ENTRY(__memset_z196)
d8307d
-	.machine "z196"
d8307d
-	.machinemode "zarch_nohighgprs"
d8307d
-# if !defined __s390x__
d8307d
-	llgfr	%r4,%r4
d8307d
-# endif /* !defined __s390x__  */
d8307d
-	ltgr    %r4,%r4
d8307d
-	je      .L_Z196_4
d8307d
+ENTRY(MEMSET_Z900_G5)
d8307d
+#if defined __s390x__
d8307d
+	.machine "z900"
d8307d
+#else
d8307d
+	.machine "g5"
d8307d
+#endif /* ! defined __s390x__  */
d8307d
+	LTGR    %r4,%r4
d8307d
+	je      .L_Z900_G5_4
d8307d
 	stc     %r3,0(%r2)
d8307d
-	lgr     %r1,%r2
d8307d
-	cghi    %r4,1
d8307d
-	je      .L_Z196_4
d8307d
-	aghi    %r4,-2
d8307d
-	srlg    %r5,%r4,8
d8307d
-	ltgr    %r5,%r5
d8307d
-	jne     .L_Z196_1
d8307d
-.L_Z196_3:
d8307d
-	exrl    %r4,.L_Z196_17
d8307d
-.L_Z196_4:
d8307d
+	CGHI    %r4,1
d8307d
+	LGR     %r1,%r2
d8307d
+	je      .L_Z900_G5_4
d8307d
+	AGHI    %r4,-2
d8307d
+#if defined __s390x__
d8307d
+	larl    %r5,.L_Z900_G5_18
d8307d
+	srlg    %r3,%r4,8
d8307d
+# define Z900_G5_EX_D 0
d8307d
+#else
d8307d
+	basr    %r5,0
d8307d
+.L_Z900_G5_19:
d8307d
+# define Z900_G5_EX_D .L_Z900_G5_18-.L_Z900_G5_19
d8307d
+	lr      %r3,%r4
d8307d
+	srl     %r3,8
d8307d
+#endif /* ! defined __s390x__  */
d8307d
+	LTGR    %r3,%r3
d8307d
+	jne     .L_Z900_G5_14
d8307d
+.L_Z900_G5_3:
d8307d
+	ex      %r4,Z900_G5_EX_D(%r5)
d8307d
+.L_Z900_G5_4:
d8307d
 	br      %r14
d8307d
-.L_Z196_1:
d8307d
-	cgfi	%r5,1048576
d8307d
-	jh	__memset_mvcle	   # Switch to mvcle for >256MB
d8307d
-.L_Z196_2:
d8307d
-	pfd     2,1024(%r1)
d8307d
+.L_Z900_G5_14:
d8307d
 	mvc     1(256,%r1),0(%r1)
d8307d
-	aghi    %r5,-1
d8307d
 	la      %r1,256(%r1)
d8307d
-	jne     .L_Z196_2
d8307d
-	j       .L_Z196_3
d8307d
-.L_Z196_17:
d8307d
+	BRCTG   %r3,.L_Z900_G5_14
d8307d
+	j       .L_Z900_G5_3
d8307d
+.L_Z900_G5_18:
d8307d
 	mvc     1(1,%r1),0(%r1)
d8307d
-END(__memset_z196)
d8307d
+END(MEMSET_Z900_G5)
d8307d
+# undef LTGR
d8307d
+# undef CGHI
d8307d
+# undef LGR
d8307d
+# undef AGHI
d8307d
+# undef BRCTG
d8307d
+#endif /*  HAVE_MEMSET_Z900_G5  */
d8307d
 
d8307d
-ENTRY(__memset_z10)
d8307d
+#if HAVE_MEMSET_Z10
d8307d
+ENTRY(MEMSET_Z10)
d8307d
 	.machine "z10"
d8307d
 	.machinemode "zarch_nohighgprs"
d8307d
 # if !defined __s390x__
d8307d
@@ -91,8 +118,46 @@ ENTRY(__memset_z10)
d8307d
 	j       .L_Z10_3
d8307d
 .L_Z10_18:
d8307d
 	mvc     1(1,%r1),0(%r1)
d8307d
-END(__memset_z10)
d8307d
+END(MEMSET_Z10)
d8307d
+#endif /* HAVE_MEMSET_Z10  */
d8307d
+
d8307d
+#if HAVE_MEMSET_Z196
d8307d
+ENTRY(MEMSET_Z196)
d8307d
+	.machine "z196"
d8307d
+	.machinemode "zarch_nohighgprs"
d8307d
+# if !defined __s390x__
d8307d
+	llgfr	%r4,%r4
d8307d
+# endif /* !defined __s390x__  */
d8307d
+	ltgr    %r4,%r4
d8307d
+	je      .L_Z196_4
d8307d
+	stc     %r3,0(%r2)
d8307d
+	lgr     %r1,%r2
d8307d
+	cghi    %r4,1
d8307d
+	je      .L_Z196_4
d8307d
+	aghi    %r4,-2
d8307d
+	srlg    %r5,%r4,8
d8307d
+	ltgr    %r5,%r5
d8307d
+	jne     .L_Z196_1
d8307d
+.L_Z196_3:
d8307d
+	exrl    %r4,.L_Z196_17
d8307d
+.L_Z196_4:
d8307d
+	br      %r14
d8307d
+.L_Z196_1:
d8307d
+	cgfi	%r5,1048576
d8307d
+	jh	__memset_mvcle	   # Switch to mvcle for >256MB
d8307d
+.L_Z196_2:
d8307d
+	pfd     2,1024(%r1)
d8307d
+	mvc     1(256,%r1),0(%r1)
d8307d
+	aghi    %r5,-1
d8307d
+	la      %r1,256(%r1)
d8307d
+	jne     .L_Z196_2
d8307d
+	j       .L_Z196_3
d8307d
+.L_Z196_17:
d8307d
+	mvc     1(1,%r1),0(%r1)
d8307d
+END(MEMSET_Z196)
d8307d
+#endif /* HAVE_MEMSET_Z196  */
d8307d
 
d8307d
+#if HAVE_MEMSET_MVCLE
d8307d
 ENTRY(__memset_mvcle)
d8307d
 	aghi	%r4,2               # take back the change done by the caller
d8307d
 	lgr	%r0,%r2		    # save source address
d8307d
@@ -106,15 +171,16 @@ ENTRY(__memset_mvcle)
d8307d
 .L1:
d8307d
 	br	%r14
d8307d
 END(__memset_mvcle)
d8307d
+#endif /* HAVE_MEMSET_MVCLE  */
d8307d
 
d8307d
-#endif /* IS_IN (libc) */
d8307d
-
d8307d
-#include "../memset.S"
d8307d
+#if ! HAVE_MEMSET_IFUNC
d8307d
+/* If we don't use ifunc, define an alias for memset here.
d8307d
+   Otherwise see sysdeps/s390/memset.c.  */
d8307d
+strong_alias (MEMSET_DEFAULT, memset)
d8307d
+#endif
d8307d
 
d8307d
-#if !IS_IN (libc)
d8307d
-.globl   memset
d8307d
-.set     memset,__memset_default
d8307d
-#elif defined SHARED && IS_IN (libc)
d8307d
-.globl   __GI_memset
d8307d
-.set     __GI_memset,__memset_default
d8307d
+#if defined SHARED && IS_IN (libc)
d8307d
+/* Defines the internal symbol.
d8307d
+   Compare to libc_hidden_builtin_def (memset) in string/memset.c.  */
d8307d
+strong_alias (MEMSET_DEFAULT, __GI_memset)
d8307d
 #endif
d8307d
diff --git a/sysdeps/s390/memset.S b/sysdeps/s390/memset.S
d8307d
deleted file mode 100644
d8307d
index 72e7c5a42efbaf6c..0000000000000000
d8307d
--- a/sysdeps/s390/memset.S
d8307d
+++ /dev/null
d8307d
@@ -1,97 +0,0 @@
d8307d
-/* Set a block of memory to some byte value.  31/64 bit S/390 version.
d8307d
-   Copyright (C) 2001-2018 Free Software Foundation, Inc.
d8307d
-   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
d8307d
-   This file is part of the GNU C Library.
d8307d
-
d8307d
-   The GNU C Library is free software; you can redistribute it and/or
d8307d
-   modify it under the terms of the GNU Lesser General Public
d8307d
-   License as published by the Free Software Foundation; either
d8307d
-   version 2.1 of the License, or (at your option) any later version.
d8307d
-
d8307d
-   The GNU C Library is distributed in the hope that it will be useful,
d8307d
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
d8307d
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
d8307d
-   Lesser General Public License for more details.
d8307d
-
d8307d
-   You should have received a copy of the GNU Lesser General Public
d8307d
-   License along with the GNU C Library; if not, see
d8307d
-   <http://www.gnu.org/licenses/>.  */
d8307d
-
d8307d
-
d8307d
-#include <sysdep.h>
d8307d
-#include "asm-syntax.h"
d8307d
-
d8307d
-/* INPUT PARAMETERS
d8307d
-     %r2 = address of memory area
d8307d
-     %r3 = byte to fill memory with
d8307d
-     %r4 = number of bytes to fill.  */
d8307d
-
d8307d
-       .text
d8307d
-
d8307d
-#if defined __s390x__
d8307d
-# define LTGR	ltgr
d8307d
-# define CGHI	cghi
d8307d
-# define LGR	lgr
d8307d
-# define AGHI	aghi
d8307d
-# define BRCTG	brctg
d8307d
-#else
d8307d
-# define LTGR	ltr
d8307d
-# define CGHI	chi
d8307d
-# define LGR	lr
d8307d
-# define AGHI	ahi
d8307d
-# define BRCTG	brct
d8307d
-#endif /* ! defined __s390x__  */
d8307d
-
d8307d
-#ifdef USE_MULTIARCH
d8307d
-ENTRY(__memset_default)
d8307d
-#else
d8307d
-ENTRY(memset)
d8307d
-#endif
d8307d
-#if defined __s390x__
d8307d
-	.machine "z900"
d8307d
-#else
d8307d
-	.machine "g5"
d8307d
-#endif /* ! defined __s390x__  */
d8307d
-	LTGR    %r4,%r4
d8307d
-	je      .L_Z900_G5_4
d8307d
-	stc     %r3,0(%r2)
d8307d
-	CGHI    %r4,1
d8307d
-	LGR     %r1,%r2
d8307d
-	je      .L_Z900_G5_4
d8307d
-	AGHI    %r4,-2
d8307d
-#if defined __s390x__
d8307d
-	larl    %r5,.L_Z900_G5_18
d8307d
-	srlg    %r3,%r4,8
d8307d
-# define Z900_G5_EX_D 0
d8307d
-#else
d8307d
-	basr    %r5,0
d8307d
-.L_Z900_G5_19:
d8307d
-# define Z900_G5_EX_D .L_Z900_G5_18-.L_Z900_G5_19
d8307d
-	lr      %r3,%r4
d8307d
-	srl     %r3,8
d8307d
-#endif /* ! defined __s390x__  */
d8307d
-	LTGR    %r3,%r3
d8307d
-	jne     .L_Z900_G5_14
d8307d
-.L_Z900_G5_3:
d8307d
-	ex      %r4,Z900_G5_EX_D(%r5)
d8307d
-.L_Z900_G5_4:
d8307d
-	br      %r14
d8307d
-.L_Z900_G5_14:
d8307d
-	mvc     1(256,%r1),0(%r1)
d8307d
-	la      %r1,256(%r1)
d8307d
-	BRCTG   %r3,.L_Z900_G5_14
d8307d
-	j       .L_Z900_G5_3
d8307d
-.L_Z900_G5_18:
d8307d
-	mvc     1(1,%r1),0(%r1)
d8307d
-#ifdef USE_MULTIARCH
d8307d
-END(__memset_default)
d8307d
-#else
d8307d
-END(memset)
d8307d
-libc_hidden_builtin_def (memset)
d8307d
-#endif
d8307d
-
d8307d
-#undef LTGR
d8307d
-#undef CGHI
d8307d
-#undef LGR
d8307d
-#undef AGHI
d8307d
-#undef BRCTG
d8307d
diff --git a/sysdeps/s390/multiarch/memset.c b/sysdeps/s390/memset.c
d8307d
similarity index 60%
d8307d
rename from sysdeps/s390/multiarch/memset.c
d8307d
rename to sysdeps/s390/memset.c
d8307d
index 760b3e9df201b8b4..57a35aebc7d3c794 100644
d8307d
--- a/sysdeps/s390/multiarch/memset.c
d8307d
+++ b/sysdeps/s390/memset.c
d8307d
@@ -16,11 +16,33 @@
d8307d
    License along with the GNU C Library; if not, see
d8307d
    <http://www.gnu.org/licenses/>.  */
d8307d
 
d8307d
-#if IS_IN (libc)
d8307d
+#include <ifunc-memset.h>
d8307d
+#if HAVE_MEMSET_IFUNC
d8307d
 # define memset __redirect_memset
d8307d
 # include <string.h>
d8307d
 # undef memset
d8307d
 # include <ifunc-resolve.h>
d8307d
 
d8307d
-s390_libc_ifunc (__redirect_memset, __memset, memset)
d8307d
+# if HAVE_MEMSET_Z900_G5
d8307d
+extern __typeof (__redirect_memset) MEMSET_Z900_G5 attribute_hidden;
d8307d
+# endif
d8307d
+
d8307d
+# if HAVE_MEMSET_Z10
d8307d
+extern __typeof (__redirect_memset) MEMSET_Z10 attribute_hidden;
d8307d
+# endif
d8307d
+
d8307d
+# if HAVE_MEMSET_Z196
d8307d
+extern __typeof (__redirect_memset) MEMSET_Z196 attribute_hidden;
d8307d
+# endif
d8307d
+
d8307d
+s390_libc_ifunc_expr (__redirect_memset, memset,
d8307d
+		      ({
d8307d
+			s390_libc_ifunc_init ();
d8307d
+			(HAVE_MEMSET_Z196 && S390_IS_Z196 (stfle_bits))
d8307d
+			  ? MEMSET_Z196
d8307d
+			  : (HAVE_MEMSET_Z10 && S390_IS_Z10 (stfle_bits))
d8307d
+			  ? MEMSET_Z10
d8307d
+			  : MEMSET_DEFAULT;
d8307d
+		      })
d8307d
+		      )
d8307d
 #endif
d8307d
diff --git a/sysdeps/s390/multiarch/Makefile b/sysdeps/s390/multiarch/Makefile
d8307d
index 93ad21bfa2686ee5..c893ebc5659fd4ae 100644
d8307d
--- a/sysdeps/s390/multiarch/Makefile
d8307d
+++ b/sysdeps/s390/multiarch/Makefile
d8307d
@@ -19,8 +19,7 @@ sysdep_routines += strlen strlen-vx strlen-c \
d8307d
 		   rawmemchr rawmemchr-vx rawmemchr-c \
d8307d
 		   memccpy memccpy-vx memccpy-c \
d8307d
 		   memrchr memrchr-vx memrchr-c \
d8307d
-		   mempcpy \
d8307d
-		   memset memset-s390x
d8307d
+		   mempcpy
d8307d
 endif
d8307d
 
d8307d
 ifeq ($(subdir),wcsmbs)
d8307d
diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c
d8307d
index ec3373ae2653d66e..2f671eac1f4f1ffd 100644
d8307d
--- a/sysdeps/s390/multiarch/ifunc-impl-list.c
d8307d
+++ b/sysdeps/s390/multiarch/ifunc-impl-list.c
d8307d
@@ -21,6 +21,7 @@
d8307d
 #include <wchar.h>
d8307d
 #include <ifunc-impl-list.h>
d8307d
 #include <ifunc-resolve.h>
d8307d
+#include <ifunc-memset.h>
d8307d
 
d8307d
 /* Maximum number of IFUNC implementations.  */
d8307d
 #define MAX_IFUNC	3
d8307d
@@ -46,12 +47,21 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
d8307d
       S390_STORE_STFLE (stfle_bits);
d8307d
     }
d8307d
 
d8307d
+#if HAVE_MEMSET_IFUNC
d8307d
   IFUNC_IMPL (i, name, memset,
d8307d
+# if HAVE_MEMSET_Z196
d8307d
 	      IFUNC_IMPL_ADD (array, i, memset,
d8307d
-			      S390_IS_Z196 (stfle_bits), __memset_z196)
d8307d
+			      S390_IS_Z196 (stfle_bits), MEMSET_Z196)
d8307d
+# endif
d8307d
+# if HAVE_MEMSET_Z10
d8307d
 	      IFUNC_IMPL_ADD (array, i, memset,
d8307d
-			      S390_IS_Z10 (stfle_bits), __memset_z10)
d8307d
-	      IFUNC_IMPL_ADD (array, i, memset, 1, __memset_default))
d8307d
+			      S390_IS_Z10 (stfle_bits), MEMSET_Z10)
d8307d
+# endif
d8307d
+# if HAVE_MEMSET_Z900_G5
d8307d
+	      IFUNC_IMPL_ADD (array, i, memset, 1, MEMSET_Z900_G5)
d8307d
+# endif
d8307d
+	      )
d8307d
+#endif /* HAVE_MEMSET_IFUNC */
d8307d
 
d8307d
   IFUNC_IMPL (i, name, memcmp,
d8307d
 	      IFUNC_IMPL_ADD (array, i, memcmp,