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/x86_64 | |
parent | 39ef07441910c2d2f8c02579e808862194b9a23b (diff) | |
download | glibc-81a14439417552324ec6ca71f65ddf8e7cdd51c7.tar glibc-81a14439417552324ec6ca71f65ddf8e7cdd51c7.tar.gz glibc-81a14439417552324ec6ca71f65ddf8e7cdd51c7.tar.bz2 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/x86_64')
-rw-r--r-- | sysdeps/x86_64/multiarch/wcscpy-c.c | 4 | ||||
-rw-r--r-- | sysdeps/x86_64/multiarch/wcscpy.c | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/sysdeps/x86_64/multiarch/wcscpy-c.c b/sysdeps/x86_64/multiarch/wcscpy-c.c index a51a83a9be..26d6984e9b 100644 --- a/sysdeps/x86_64/multiarch/wcscpy-c.c +++ b/sysdeps/x86_64/multiarch/wcscpy-c.c @@ -1,5 +1,5 @@ #if IS_IN (libc) -# define wcscpy __wcscpy_sse2 +# define WCSCPY __wcscpy_sse2 #endif -#include "wcsmbs/wcscpy.c" +#include <wcsmbs/wcscpy.c> diff --git a/sysdeps/x86_64/multiarch/wcscpy.c b/sysdeps/x86_64/multiarch/wcscpy.c index 101a585358..96151b4963 100644 --- a/sysdeps/x86_64/multiarch/wcscpy.c +++ b/sysdeps/x86_64/multiarch/wcscpy.c @@ -19,9 +19,9 @@ /* Define multiple versions only for the definition in libc. */ #if IS_IN (libc) -# define wcscpy __redirect_wcscpy +# define __wcscpy __redirect_wcscpy # include <wchar.h> -# undef wcscpy +# undef __wcscpy # define SYMBOL_NAME wcscpy # include <init-arch.h> @@ -40,5 +40,10 @@ IFUNC_SELECTOR (void) return OPTIMIZE (sse2); } -libc_ifunc_redirected (__redirect_wcscpy, wcscpy, IFUNC_SELECTOR ()); +libc_ifunc_redirected (__redirect_wcscpy, __wcscpy, IFUNC_SELECTOR ()); +weak_alias (__wcscpy, wcscpy) +# ifdef SHARED +__hidden_ver1 (__wcscpy, __GI___wcscpy, __redirect_wcscpy) + __attribute__((visibility ("hidden"))) __attribute_copy__ (wcscpy); +# endif #endif |