From 18d6c45e12127ea88a704c0915de2ba13d3af998 Mon Sep 17 00:00:00 2001 From: Stefan Liebler Date: Fri, 7 Oct 2016 09:56:47 +0200 Subject: [PATCH] s390: Refactor ifunc resolvers due to false debuginfo. This patch adjusts the s390 specific ifunc helper macros in ifunc-resolve.h to use the common __ifunc macro, which uses gcc attribute ifunc to get rid of the false debuginfo. Therefore the redirection construct is applied where needed. Perhaps in future we can switch some of the internal symbols __GI_* from the fallback variant to the ifunc function. But this change is not straightforward due to a segmentation fault while linking libc.so with older binutils on s390. ChangeLog: [BZ #20478] * sysdeps/s390/multiarch/ifunc-resolve.h (s390_vx_libc_ifunc2, s390_libc_ifunc): Use __ifunc from libc-symbols.h to create ifunc symbols. (s390_vx_libc_ifunc_init, s390_vx_libc_ifunc_redirected , s390_vx_libc_ifunc2_redirected, s390_libc_ifunc_init): New define. * sysdeps/s390/multiarch/memchr.c: Redirect ifunced function in header for using it as type for ifunc function. * sysdeps/s390/multiarch/mempcpy.c: Likewise. * sysdeps/s390/multiarch/rawmemchr.c: Likewise. * sysdeps/s390/multiarch/stpcpy.c: Likewise. * sysdeps/s390/multiarch/stpncpy.c: Likewise. * sysdeps/s390/multiarch/strcat.c: Likewise. * sysdeps/s390/multiarch/strchr.c: Likewise. * sysdeps/s390/multiarch/strcmp.c: Likewise. * sysdeps/s390/multiarch/strcpy.c: Likewise. * sysdeps/s390/multiarch/strcspn.c: Likewise. * sysdeps/s390/multiarch/strlen.c: Likewise. * sysdeps/s390/multiarch/strncmp.c: Likewise. * sysdeps/s390/multiarch/strncpy.c: Likewise. * sysdeps/s390/multiarch/strnlen.c: Likewise. * sysdeps/s390/multiarch/strpbrk.c: Likewise. * sysdeps/s390/multiarch/strrchr.c: Likewise. * sysdeps/s390/multiarch/strspn.c: Likewise. * sysdeps/s390/multiarch/wcschr.c: Likewise. * sysdeps/s390/multiarch/wcscmp.c: Likewise. * sysdeps/s390/multiarch/wcspbrk.c: Likewise. * sysdeps/s390/multiarch/wcsspn.c: Likewise. * sysdeps/s390/multiarch/wmemchr.c: Likewise. * sysdeps/s390/multiarch/wmemset.c: Likewise. * sysdeps/s390/s390-32/multiarch/memcmp.c: Likewise. * sysdeps/s390/s390-32/multiarch/memcpy.c: Likewise. * sysdeps/s390/s390-32/multiarch/memset.c: Likewise. * sysdeps/s390/s390-64/multiarch/memcmp.c: Likewise. * sysdeps/s390/s390-64/multiarch/memcpy.c: Likewise. * sysdeps/s390/s390-64/multiarch/memset.c: Likewise. --- ChangeLog | 39 +++++++++++++ sysdeps/s390/multiarch/ifunc-resolve.h | 77 +++++++++++-------------- sysdeps/s390/multiarch/memchr.c | 5 +- sysdeps/s390/multiarch/mempcpy.c | 12 +++- sysdeps/s390/multiarch/rawmemchr.c | 5 +- sysdeps/s390/multiarch/stpcpy.c | 9 ++- sysdeps/s390/multiarch/stpncpy.c | 6 +- sysdeps/s390/multiarch/strcat.c | 4 +- sysdeps/s390/multiarch/strchr.c | 6 +- sysdeps/s390/multiarch/strcmp.c | 9 ++- sysdeps/s390/multiarch/strcpy.c | 5 +- sysdeps/s390/multiarch/strcspn.c | 6 +- sysdeps/s390/multiarch/strlen.c | 4 +- sysdeps/s390/multiarch/strncmp.c | 9 +-- sysdeps/s390/multiarch/strncpy.c | 7 ++- sysdeps/s390/multiarch/strnlen.c | 7 ++- sysdeps/s390/multiarch/strpbrk.c | 6 +- sysdeps/s390/multiarch/strrchr.c | 6 +- sysdeps/s390/multiarch/strspn.c | 6 +- sysdeps/s390/multiarch/wcschr.c | 7 ++- sysdeps/s390/multiarch/wcscmp.c | 4 +- sysdeps/s390/multiarch/wcspbrk.c | 4 +- sysdeps/s390/multiarch/wcsspn.c | 4 +- sysdeps/s390/multiarch/wmemchr.c | 7 ++- sysdeps/s390/multiarch/wmemset.c | 7 ++- sysdeps/s390/s390-32/multiarch/memcmp.c | 7 ++- sysdeps/s390/s390-32/multiarch/memcpy.c | 5 +- sysdeps/s390/s390-32/multiarch/memset.c | 5 +- sysdeps/s390/s390-64/multiarch/memcmp.c | 7 ++- sysdeps/s390/s390-64/multiarch/memcpy.c | 5 +- sysdeps/s390/s390-64/multiarch/memset.c | 5 +- 31 files changed, 209 insertions(+), 86 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8fb29da25a..6069c23606 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +2016-10-07 Stefan Liebler + + [BZ #20478] + * sysdeps/s390/multiarch/ifunc-resolve.h + (s390_vx_libc_ifunc2, s390_libc_ifunc): Use __ifunc from libc-symbols.h + to create ifunc symbols. + (s390_vx_libc_ifunc_init, s390_vx_libc_ifunc_redirected + , s390_vx_libc_ifunc2_redirected, s390_libc_ifunc_init): New define. + * sysdeps/s390/multiarch/memchr.c: Redirect ifunced function in header + for using it as type for ifunc function. + * sysdeps/s390/multiarch/mempcpy.c: Likewise. + * sysdeps/s390/multiarch/rawmemchr.c: Likewise. + * sysdeps/s390/multiarch/stpcpy.c: Likewise. + * sysdeps/s390/multiarch/stpncpy.c: Likewise. + * sysdeps/s390/multiarch/strcat.c: Likewise. + * sysdeps/s390/multiarch/strchr.c: Likewise. + * sysdeps/s390/multiarch/strcmp.c: Likewise. + * sysdeps/s390/multiarch/strcpy.c: Likewise. + * sysdeps/s390/multiarch/strcspn.c: Likewise. + * sysdeps/s390/multiarch/strlen.c: Likewise. + * sysdeps/s390/multiarch/strncmp.c: Likewise. + * sysdeps/s390/multiarch/strncpy.c: Likewise. + * sysdeps/s390/multiarch/strnlen.c: Likewise. + * sysdeps/s390/multiarch/strpbrk.c: Likewise. + * sysdeps/s390/multiarch/strrchr.c: Likewise. + * sysdeps/s390/multiarch/strspn.c: Likewise. + * sysdeps/s390/multiarch/wcschr.c: Likewise. + * sysdeps/s390/multiarch/wcscmp.c: Likewise. + * sysdeps/s390/multiarch/wcspbrk.c: Likewise. + * sysdeps/s390/multiarch/wcsspn.c: Likewise. + * sysdeps/s390/multiarch/wmemchr.c: Likewise. + * sysdeps/s390/multiarch/wmemset.c: Likewise. + * sysdeps/s390/s390-32/multiarch/memcmp.c: Likewise. + * sysdeps/s390/s390-32/multiarch/memcpy.c: Likewise. + * sysdeps/s390/s390-32/multiarch/memset.c: Likewise. + * sysdeps/s390/s390-64/multiarch/memcmp.c: Likewise. + * sysdeps/s390/s390-64/multiarch/memcpy.c: Likewise. + * sysdeps/s390/s390-64/multiarch/memset.c: Likewise. + 2016-10-07 Stefan Liebler * include/libc-symbols.h (__ifunc_resolver): diff --git a/sysdeps/s390/multiarch/ifunc-resolve.h b/sysdeps/s390/multiarch/ifunc-resolve.h index 26e097ad6e..768829b39b 100644 --- a/sysdeps/s390/multiarch/ifunc-resolve.h +++ b/sysdeps/s390/multiarch/ifunc-resolve.h @@ -40,53 +40,46 @@ ".machine pop" "\n" \ : "=QS" (STFLE_BITS), "+d" (reg0) \ : : "cc"); +#define s390_libc_ifunc_init() \ + unsigned long long stfle_bits = 0ULL; \ + if (__glibc_likely((dl_hwcap & HWCAP_S390_STFLE) \ + && (dl_hwcap & HWCAP_S390_ZARCH) \ + && (dl_hwcap & HWCAP_S390_HIGH_GPRS))) \ + { \ + S390_STORE_STFLE (stfle_bits); \ + } -#define s390_libc_ifunc(FUNC) \ - __asm__ (".globl " #FUNC "\n\t" \ - ".type " #FUNC ",@gnu_indirect_function\n\t" \ - ".set " #FUNC ",__resolve_" #FUNC "\n\t"); \ - \ +#define s390_libc_ifunc(TYPE_FUNC, RESOLVERFUNC, FUNC) \ /* Make the declarations of the optimized functions hidden in order to prevent GOT slots being generated for them. */ \ - extern void *__##FUNC##_z196 attribute_hidden; \ - extern void *__##FUNC##_z10 attribute_hidden; \ - extern void *__##FUNC##_default attribute_hidden; \ - \ - void *__resolve_##FUNC (unsigned long int dl_hwcap) \ - { \ - if ((dl_hwcap & HWCAP_S390_STFLE) \ - && (dl_hwcap & HWCAP_S390_ZARCH) \ - && (dl_hwcap & HWCAP_S390_HIGH_GPRS)) \ - { \ - unsigned long long stfle_bits; \ - S390_STORE_STFLE (stfle_bits); \ - \ - if (S390_IS_Z196 (stfle_bits)) \ - return &__##FUNC##_z196; \ - else if (S390_IS_Z10 (stfle_bits)) \ - return &__##FUNC##_z10; \ - else \ - return &__##FUNC##_default; \ - } \ - else \ - return &__##FUNC##_default; \ - } + extern __typeof (TYPE_FUNC) RESOLVERFUNC##_z196 attribute_hidden; \ + extern __typeof (TYPE_FUNC) RESOLVERFUNC##_z10 attribute_hidden; \ + extern __typeof (TYPE_FUNC) RESOLVERFUNC##_default attribute_hidden; \ + __ifunc (TYPE_FUNC, FUNC, \ + __glibc_likely (S390_IS_Z196 (stfle_bits)) \ + ? RESOLVERFUNC##_z196 \ + : __glibc_likely (S390_IS_Z10 (stfle_bits)) \ + ? RESOLVERFUNC##_z10 \ + : RESOLVERFUNC##_default, \ + unsigned long int dl_hwcap, s390_libc_ifunc_init); #define s390_vx_libc_ifunc(FUNC) \ - s390_vx_libc_ifunc2(FUNC, FUNC) + s390_vx_libc_ifunc2_redirected(FUNC, FUNC, FUNC) -#define s390_vx_libc_ifunc2(RESOLVERFUNC, FUNC) \ +#define s390_vx_libc_ifunc_redirected(TYPE_FUNC, FUNC) \ + s390_vx_libc_ifunc2_redirected(TYPE_FUNC, FUNC, FUNC) + +#define s390_vx_libc_ifunc2(RESOLVERFUNC, FUNC) \ + s390_vx_libc_ifunc2_redirected(FUNC, RESOLVERFUNC, FUNC) + +#define s390_vx_libc_ifunc_init() +#define s390_vx_libc_ifunc2_redirected(TYPE_FUNC, RESOLVERFUNC, FUNC) \ /* Make the declarations of the optimized functions hidden in order to prevent GOT slots being generated for them. */ \ - extern __typeof (FUNC) RESOLVERFUNC##_vx attribute_hidden; \ - extern __typeof (FUNC) RESOLVERFUNC##_c attribute_hidden; \ - extern void *__resolve_##RESOLVERFUNC (unsigned long int) __asm__ (#FUNC); \ - \ - void *__resolve_##RESOLVERFUNC (unsigned long int dl_hwcap) \ - { \ - if (dl_hwcap & HWCAP_S390_VX) \ - return &RESOLVERFUNC##_vx; \ - else \ - return &RESOLVERFUNC##_c; \ - } \ - __asm__ (".type " #FUNC ", %gnu_indirect_function"); + extern __typeof (TYPE_FUNC) RESOLVERFUNC##_vx attribute_hidden; \ + extern __typeof (TYPE_FUNC) RESOLVERFUNC##_c attribute_hidden; \ + __ifunc (TYPE_FUNC, FUNC, \ + (dl_hwcap & HWCAP_S390_VX) \ + ? RESOLVERFUNC##_vx \ + : RESOLVERFUNC##_c, \ + unsigned long int dl_hwcap, s390_vx_libc_ifunc_init); diff --git a/sysdeps/s390/multiarch/memchr.c b/sysdeps/s390/multiarch/memchr.c index f80de1cc1f..891ec7aa56 100644 --- a/sysdeps/s390/multiarch/memchr.c +++ b/sysdeps/s390/multiarch/memchr.c @@ -17,8 +17,11 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define memchr __redirect_memchr # include +# undef memchr # include -s390_vx_libc_ifunc2 (__memchr, memchr) +s390_vx_libc_ifunc2_redirected (__redirect_memchr, __memchr, memchr) + #endif diff --git a/sysdeps/s390/multiarch/mempcpy.c b/sysdeps/s390/multiarch/mempcpy.c index 34d8329ba8..bee3ee47bb 100644 --- a/sysdeps/s390/multiarch/mempcpy.c +++ b/sysdeps/s390/multiarch/mempcpy.c @@ -18,9 +18,15 @@ #if defined SHARED && IS_IN (libc) +# define mempcpy __redirect_mempcpy +# define __mempcpy __redirect___mempcpy +/* Omit the mempcpy inline definitions because it would redefine mempcpy. */ +# define _HAVE_STRING_ARCH_mempcpy 1 +# include +# undef mempcpy +# undef __mempcpy # include -s390_libc_ifunc (__mempcpy) -__asm__ (".weak mempcpy\n\t" - ".set mempcpy,__mempcpy\n\t"); +s390_libc_ifunc (__redirect___mempcpy, ____mempcpy, __mempcpy) +weak_alias (__mempcpy, mempcpy); #endif diff --git a/sysdeps/s390/multiarch/rawmemchr.c b/sysdeps/s390/multiarch/rawmemchr.c index 7186ccd9d4..c4afa24004 100644 --- a/sysdeps/s390/multiarch/rawmemchr.c +++ b/sysdeps/s390/multiarch/rawmemchr.c @@ -17,10 +17,13 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define __rawmemchr __redirect___rawmemchr # include +# undef __rawmemchr # include -s390_vx_libc_ifunc (__rawmemchr) +s390_vx_libc_ifunc2_redirected (__redirect___rawmemchr, __rawmemchr + , __rawmemchr) weak_alias (__rawmemchr, rawmemchr) #else diff --git a/sysdeps/s390/multiarch/stpcpy.c b/sysdeps/s390/multiarch/stpcpy.c index dcde01278b..cea6c0793f 100644 --- a/sysdeps/s390/multiarch/stpcpy.c +++ b/sysdeps/s390/multiarch/stpcpy.c @@ -17,13 +17,18 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define stpcpy __redirect_stpcpy +# define __stpcpy __redirect___stpcpy +/* Omit the stpcpy inline definitions because it would redefine stpcpy. */ +# define __NO_STRING_INLINES # define NO_MEMPCPY_STPCPY_REDIRECT # include +# undef stpcpy +# undef __stpcpy # include -s390_vx_libc_ifunc (__stpcpy) +s390_vx_libc_ifunc_redirected (__redirect___stpcpy, __stpcpy); weak_alias (__stpcpy, stpcpy) -libc_hidden_builtin_def (stpcpy) #else # include diff --git a/sysdeps/s390/multiarch/stpncpy.c b/sysdeps/s390/multiarch/stpncpy.c index f5335b42ac..cbbe8ba4fe 100644 --- a/sysdeps/s390/multiarch/stpncpy.c +++ b/sysdeps/s390/multiarch/stpncpy.c @@ -17,10 +17,14 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define stpncpy __redirect_stpncpy +# define __stpncpy __redirect___stpncpy # include +# undef stpncpy +# undef __stpncpy # include -s390_vx_libc_ifunc (__stpncpy) +s390_vx_libc_ifunc_redirected (__redirect___stpncpy, __stpncpy) weak_alias (__stpncpy, stpncpy) #else diff --git a/sysdeps/s390/multiarch/strcat.c b/sysdeps/s390/multiarch/strcat.c index c3b5e1c9d6..0c74c91954 100644 --- a/sysdeps/s390/multiarch/strcat.c +++ b/sysdeps/s390/multiarch/strcat.c @@ -17,10 +17,12 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define strcat __redirect_strcat # include +# undef strcat # include -s390_vx_libc_ifunc2 (__strcat, strcat) +s390_vx_libc_ifunc2_redirected (__redirect_strcat, __strcat, strcat) #else # include diff --git a/sysdeps/s390/multiarch/strchr.c b/sysdeps/s390/multiarch/strchr.c index 3c8c7e4600..3b378b9320 100644 --- a/sysdeps/s390/multiarch/strchr.c +++ b/sysdeps/s390/multiarch/strchr.c @@ -17,10 +17,14 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define strchr __redirect_strchr +/* Omit the strchr inline definitions because it would redefine strchr. */ +# define __NO_STRING_INLINES # include +# undef strchr # include -s390_vx_libc_ifunc2 (__strchr, strchr) +s390_vx_libc_ifunc2_redirected (__redirect_strchr, __strchr, strchr) weak_alias (strchr, index) #else diff --git a/sysdeps/s390/multiarch/strcmp.c b/sysdeps/s390/multiarch/strcmp.c index c4ccd34420..faeaaa54a6 100644 --- a/sysdeps/s390/multiarch/strcmp.c +++ b/sysdeps/s390/multiarch/strcmp.c @@ -17,10 +17,13 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define strcmp __redirect_strcmp +/* Omit the strcmp inline definitions because it would redefine strcmp. */ +# define __NO_STRING_INLINES # include # include - - # undef strcmp -s390_vx_libc_ifunc2 (__strcmp, strcmp) + +s390_vx_libc_ifunc2_redirected (__redirect_strcmp, __strcmp, strcmp) + #endif diff --git a/sysdeps/s390/multiarch/strcpy.c b/sysdeps/s390/multiarch/strcpy.c index f348199112..9053b12963 100644 --- a/sysdeps/s390/multiarch/strcpy.c +++ b/sysdeps/s390/multiarch/strcpy.c @@ -17,8 +17,11 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define strcpy __redirect_strcpy # include +# undef strcpy # include -s390_vx_libc_ifunc2 (__strcpy, strcpy) +s390_vx_libc_ifunc2_redirected (__redirect_strcpy, __strcpy, strcpy) + #endif diff --git a/sysdeps/s390/multiarch/strcspn.c b/sysdeps/s390/multiarch/strcspn.c index c23452a791..d1fe33b91f 100644 --- a/sysdeps/s390/multiarch/strcspn.c +++ b/sysdeps/s390/multiarch/strcspn.c @@ -17,10 +17,14 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define strcspn __redirect_strcspn +/* Omit the strcspn inline definitions because it would redefine strcspn. */ +# define __NO_STRING_INLINES # include +# undef strcspn # include -s390_vx_libc_ifunc2 (__strcspn, strcspn) +s390_vx_libc_ifunc2_redirected (__redirect_strcspn, __strcspn, strcspn) #else # include diff --git a/sysdeps/s390/multiarch/strlen.c b/sysdeps/s390/multiarch/strlen.c index 098d4e1e58..8329f2bec6 100644 --- a/sysdeps/s390/multiarch/strlen.c +++ b/sysdeps/s390/multiarch/strlen.c @@ -17,10 +17,12 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define strlen __redirect_strlen # include # include +# undef strlen -s390_vx_libc_ifunc2 (__strlen, strlen) +s390_vx_libc_ifunc2_redirected (__redirect_strlen, __strlen, strlen) #else # include diff --git a/sysdeps/s390/multiarch/strncmp.c b/sysdeps/s390/multiarch/strncmp.c index 9a72c79bfd..2bdf4bf8de 100644 --- a/sysdeps/s390/multiarch/strncmp.c +++ b/sysdeps/s390/multiarch/strncmp.c @@ -17,13 +17,14 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define strncmp __redirect_strncmp +/* Omit the strncmp inline definitions because it would redefine strncmp. */ +# define __NO_STRING_INLINES # include +# undef strncmp # include - -# undef strcmp -extern __typeof (strncmp) __strncmp; -s390_vx_libc_ifunc2 (__strncmp, strncmp) +s390_vx_libc_ifunc2_redirected (__redirect_strncmp, __strncmp, strncmp) #else # include diff --git a/sysdeps/s390/multiarch/strncpy.c b/sysdeps/s390/multiarch/strncpy.c index 1464551875..c4d13a98a9 100644 --- a/sysdeps/s390/multiarch/strncpy.c +++ b/sysdeps/s390/multiarch/strncpy.c @@ -17,8 +17,13 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define strncpy __redirect_strncpy +/* Omit the strncpy inline definitions because it would redefine strncpy. */ +# define __NO_STRING_INLINES # include +# undef strncpy # include -s390_vx_libc_ifunc2 (__strncpy, strncpy) +s390_vx_libc_ifunc2_redirected (__redirect_strncpy, __strncpy, strncpy); + #endif diff --git a/sysdeps/s390/multiarch/strnlen.c b/sysdeps/s390/multiarch/strnlen.c index 48c3bb73e6..ecb69ebad3 100644 --- a/sysdeps/s390/multiarch/strnlen.c +++ b/sysdeps/s390/multiarch/strnlen.c @@ -17,12 +17,15 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define strnlen __redirect_strnlen +# define __strnlen __redirect___strnlen # include +# undef strnlen +# undef __strnlen # include -s390_vx_libc_ifunc (__strnlen) +s390_vx_libc_ifunc_redirected (__redirect___strnlen, __strnlen) weak_alias (__strnlen, strnlen) -libc_hidden_def (strnlen) #else # include diff --git a/sysdeps/s390/multiarch/strpbrk.c b/sysdeps/s390/multiarch/strpbrk.c index cdc139929f..09c3fffdf1 100644 --- a/sysdeps/s390/multiarch/strpbrk.c +++ b/sysdeps/s390/multiarch/strpbrk.c @@ -17,10 +17,14 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define strpbrk __redirect_strpbrk +/* Omit the strpbrk inline definitions because it would redefine strpbrk. */ +# define __NO_STRING_INLINES # include +# undef strpbrk # include -s390_vx_libc_ifunc2 (__strpbrk, strpbrk) +s390_vx_libc_ifunc2_redirected (__redirect_strpbrk, __strpbrk, strpbrk) #else # include diff --git a/sysdeps/s390/multiarch/strrchr.c b/sysdeps/s390/multiarch/strrchr.c index e515d6b6e6..2da8581708 100644 --- a/sysdeps/s390/multiarch/strrchr.c +++ b/sysdeps/s390/multiarch/strrchr.c @@ -17,11 +17,13 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define strrchr __redirect_strrchr # include +# undef strrchr # include -s390_vx_libc_ifunc2 (__strrchr, strrchr) -weak_alias (strrchr, rindex) +s390_vx_libc_ifunc2_redirected (__redirect_strrchr, __strrchr, strrchr) +weak_alias (strrchr, rindex); #else # include diff --git a/sysdeps/s390/multiarch/strspn.c b/sysdeps/s390/multiarch/strspn.c index 7c26af8ced..1d9514d463 100644 --- a/sysdeps/s390/multiarch/strspn.c +++ b/sysdeps/s390/multiarch/strspn.c @@ -17,10 +17,14 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define strspn __redirect_strspn +/* Omit the strspn inline definitions because it would redefine strspn. */ +# define __NO_STRING_INLINES # include +# undef strspn # include -s390_vx_libc_ifunc2 (__strspn, strspn) +s390_vx_libc_ifunc2_redirected (__redirect_strspn, __strspn, strspn) #else # include diff --git a/sysdeps/s390/multiarch/wcschr.c b/sysdeps/s390/multiarch/wcschr.c index fb51097cd6..3e0ff8b6db 100644 --- a/sysdeps/s390/multiarch/wcschr.c +++ b/sysdeps/s390/multiarch/wcschr.c @@ -17,12 +17,15 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define wcschr __redirect_wcschr +# define __wcschr __redirect___wcschr # include +# undef wcschr +# undef __wcschr # include -s390_vx_libc_ifunc (__wcschr) +s390_vx_libc_ifunc_redirected (__redirect___wcschr, __wcschr) weak_alias (__wcschr, wcschr) -libc_hidden_weak (wcschr) #else # include diff --git a/sysdeps/s390/multiarch/wcscmp.c b/sysdeps/s390/multiarch/wcscmp.c index 705ef4596e..dc29b32a29 100644 --- a/sysdeps/s390/multiarch/wcscmp.c +++ b/sysdeps/s390/multiarch/wcscmp.c @@ -17,10 +17,12 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define __wcscmp __redirect___wcscmp # include +# undef __wcscmp # include -s390_vx_libc_ifunc (__wcscmp) +s390_vx_libc_ifunc_redirected (__redirect___wcscmp, __wcscmp) weak_alias (__wcscmp, wcscmp) #else diff --git a/sysdeps/s390/multiarch/wcspbrk.c b/sysdeps/s390/multiarch/wcspbrk.c index 198144d2c5..9824bd536c 100644 --- a/sysdeps/s390/multiarch/wcspbrk.c +++ b/sysdeps/s390/multiarch/wcspbrk.c @@ -17,10 +17,12 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define wcspbrk __redirect_wcspbrk # include +# undef wcspbrk # include -s390_vx_libc_ifunc2 (__wcspbrk, wcspbrk) +s390_vx_libc_ifunc2_redirected (__redirect_wcspbrk, __wcspbrk, wcspbrk) #else # include diff --git a/sysdeps/s390/multiarch/wcsspn.c b/sysdeps/s390/multiarch/wcsspn.c index 167a881d13..d153d44b2f 100644 --- a/sysdeps/s390/multiarch/wcsspn.c +++ b/sysdeps/s390/multiarch/wcsspn.c @@ -17,10 +17,12 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define wcsspn __redirect_wcsspn # include +# undef wcsspn # include -s390_vx_libc_ifunc2 (__wcsspn, wcsspn) +s390_vx_libc_ifunc2_redirected (__redirect_wcsspn, __wcsspn, wcsspn) #else # include diff --git a/sysdeps/s390/multiarch/wmemchr.c b/sysdeps/s390/multiarch/wmemchr.c index f2bfe3c7a5..45b344182f 100644 --- a/sysdeps/s390/multiarch/wmemchr.c +++ b/sysdeps/s390/multiarch/wmemchr.c @@ -17,12 +17,15 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define wmemchr __redirect_wmemchr +# define __wmemchr __redirect___wmemchr # include +# undef wmemchr +# undef __wmemchr # include -s390_vx_libc_ifunc (__wmemchr) +s390_vx_libc_ifunc_redirected (__redirect___wmemchr, __wmemchr) weak_alias (__wmemchr, wmemchr) -libc_hidden_weak (wmemchr) #else # include diff --git a/sysdeps/s390/multiarch/wmemset.c b/sysdeps/s390/multiarch/wmemset.c index e9e695fc0a..2fc57ee71d 100644 --- a/sysdeps/s390/multiarch/wmemset.c +++ b/sysdeps/s390/multiarch/wmemset.c @@ -17,12 +17,15 @@ . */ #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +# define wmemset __redirect_wmemset +# define __wmemset __redirect___wmemset # include +# undef wmemset +# undef __wmemset # include -s390_vx_libc_ifunc (__wmemset) +s390_vx_libc_ifunc_redirected (__redirect___wmemset, __wmemset) weak_alias (__wmemset, wmemset) -libc_hidden_weak (wmemset) #else # include diff --git a/sysdeps/s390/s390-32/multiarch/memcmp.c b/sysdeps/s390/s390-32/multiarch/memcmp.c index 44f72dc8ca..453b1706f7 100644 --- a/sysdeps/s390/s390-32/multiarch/memcmp.c +++ b/sysdeps/s390/s390-32/multiarch/memcmp.c @@ -17,8 +17,11 @@ . */ #if IS_IN (libc) +# define memcmp __redirect_memcmp +# include +# undef memcmp # include -s390_libc_ifunc (memcmp) -__asm__(".weak bcmp ; bcmp = memcmp"); +s390_libc_ifunc (__redirect_memcmp, __memcmp, memcmp) +weak_alias (memcmp, bcmp); #endif diff --git a/sysdeps/s390/s390-32/multiarch/memcpy.c b/sysdeps/s390/s390-32/multiarch/memcpy.c index 2a98aa0b82..33e4bcdca2 100644 --- a/sysdeps/s390/s390-32/multiarch/memcpy.c +++ b/sysdeps/s390/s390-32/multiarch/memcpy.c @@ -18,7 +18,10 @@ /* In the static lib memcpy is needed before the reloc is resolved. */ #if defined SHARED && IS_IN (libc) +# define memcpy __redirect_memcpy +# include +# undef memcpy # include -s390_libc_ifunc (memcpy) +s390_libc_ifunc (__redirect_memcpy, __memcpy, memcpy) #endif diff --git a/sysdeps/s390/s390-32/multiarch/memset.c b/sysdeps/s390/s390-32/multiarch/memset.c index 89b8102f2a..84ddedaf04 100644 --- a/sysdeps/s390/s390-32/multiarch/memset.c +++ b/sysdeps/s390/s390-32/multiarch/memset.c @@ -17,7 +17,10 @@ . */ #if IS_IN (libc) +# define memset __redirect_memset +# include +# undef memset # include -s390_libc_ifunc (memset) +s390_libc_ifunc (__redirect_memset, __memset, memset) #endif diff --git a/sysdeps/s390/s390-64/multiarch/memcmp.c b/sysdeps/s390/s390-64/multiarch/memcmp.c index 44f72dc8ca..453b1706f7 100644 --- a/sysdeps/s390/s390-64/multiarch/memcmp.c +++ b/sysdeps/s390/s390-64/multiarch/memcmp.c @@ -17,8 +17,11 @@ . */ #if IS_IN (libc) +# define memcmp __redirect_memcmp +# include +# undef memcmp # include -s390_libc_ifunc (memcmp) -__asm__(".weak bcmp ; bcmp = memcmp"); +s390_libc_ifunc (__redirect_memcmp, __memcmp, memcmp) +weak_alias (memcmp, bcmp); #endif diff --git a/sysdeps/s390/s390-64/multiarch/memcpy.c b/sysdeps/s390/s390-64/multiarch/memcpy.c index 2a98aa0b82..33e4bcdca2 100644 --- a/sysdeps/s390/s390-64/multiarch/memcpy.c +++ b/sysdeps/s390/s390-64/multiarch/memcpy.c @@ -18,7 +18,10 @@ /* In the static lib memcpy is needed before the reloc is resolved. */ #if defined SHARED && IS_IN (libc) +# define memcpy __redirect_memcpy +# include +# undef memcpy # include -s390_libc_ifunc (memcpy) +s390_libc_ifunc (__redirect_memcpy, __memcpy, memcpy) #endif diff --git a/sysdeps/s390/s390-64/multiarch/memset.c b/sysdeps/s390/s390-64/multiarch/memset.c index 89b8102f2a..84ddedaf04 100644 --- a/sysdeps/s390/s390-64/multiarch/memset.c +++ b/sysdeps/s390/s390-64/multiarch/memset.c @@ -17,7 +17,10 @@ . */ #if IS_IN (libc) +# define memset __redirect_memset +# include +# undef memset # include -s390_libc_ifunc (memset) +s390_libc_ifunc (__redirect_memset, __memset, memset) #endif