diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2019-02-05 17:35:12 -0200 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2019-02-27 10:00:37 -0300 |
commit | 81a14439417552324ec6ca71f65ddf8e7cdd51c7 (patch) | |
tree | 3300f5fec6acc1ef4c95c333bf165ebb51248f68 /sysdeps/powerpc/powerpc32/power4/multiarch | |
parent | 39ef07441910c2d2f8c02579e808862194b9a23b (diff) | |
download | glibc-81a14439417552324ec6ca71f65ddf8e7cdd51c7.tar.gz glibc-81a14439417552324ec6ca71f65ddf8e7cdd51c7.tar.xz glibc-81a14439417552324ec6ca71f65ddf8e7cdd51c7.zip |
wcsmbs: optimize wcscat
This patch rewrites wcscat using wcslen and wcscpy. This is similar to the optimization done on strcat by 6e46de42fe. The strcpy changes are mainly to add the internal alias to avoid PLT calls. Checked on x86_64-linux-gnu and a build against the affected architectures. * include/wchar.h (__wcscpy): New prototype. * sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c (__wcscpy): Route internal symbol to generic implementation. * sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c (wcscpy): Add internal __wcscpy alias. * sysdeps/powerpc/powerpc64/multiarch/wcscpy.c (wcscpy): Likewise. * sysdeps/s390/wcscpy.c (wcscpy): Likewise. * sysdeps/x86_64/multiarch/wcscpy.c (wcscpy): Likewise. * wcsmbs/wcscpy.c (wcscpy): Add * sysdeps/x86_64/multiarch/wcscpy-c.c (WCSCPY): Adjust macro to use generic implementation. * wcsmbs/wcscat.c (wcscat): Rewrite using wcslen and wcscpy.
Diffstat (limited to 'sysdeps/powerpc/powerpc32/power4/multiarch')
-rw-r--r-- | sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c | 9 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c | 24 |
2 files changed, 17 insertions, 16 deletions
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c index 52b692b47b..31e0d81ef0 100644 --- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c +++ b/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c @@ -17,10 +17,11 @@ #include <wchar.h> -#if IS_IN (libc) -# define WCSCPY __wcscpy_ppc -#endif - extern __typeof (wcscpy) __wcscpy_ppc; +#define WCSCPY __wcscpy_ppc #include <wcsmbs/wcscpy.c> + +#ifdef SHARED +__hidden_ver1 (__wcscpy_ppc, __GI___wcscpy, __wcscpy_ppc); +#endif diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c index ecca37d5d6..e87984669e 100644 --- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c +++ b/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c @@ -17,20 +17,20 @@ <http://www.gnu.org/licenses/>. */ #if IS_IN (libc) +# define wcscpy __redirect_wcscpy # include <wchar.h> -# include <shlib-compat.h> +# undef wcscpy # include "init-arch.h" -extern __typeof (wcscpy) __wcscpy_ppc attribute_hidden; -extern __typeof (wcscpy) __wcscpy_power6 attribute_hidden; -extern __typeof (wcscpy) __wcscpy_power7 attribute_hidden; +extern __typeof (__redirect_wcscpy) __wcscpy_ppc attribute_hidden; +extern __typeof (__redirect_wcscpy) __wcscpy_power6 attribute_hidden; +extern __typeof (__redirect_wcscpy) __wcscpy_power7 attribute_hidden; -libc_ifunc (wcscpy, - (hwcap & PPC_FEATURE_HAS_VSX) - ? __wcscpy_power7 : - (hwcap & PPC_FEATURE_ARCH_2_05) - ? __wcscpy_power6 - : __wcscpy_ppc); -#else -#include <wcsmbs/wcscpy.c> +libc_ifunc_redirected (__redirect_wcscpy, wcscpy, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __wcscpy_power7 : + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __wcscpy_power6 + : __wcscpy_ppc); +weak_alias (wcscpy, __wcscpy) #endif |