diff options
-rw-r--r-- | sysdeps/i386/i686/multiarch/Makefile | 3 | ||||
-rw-r--r-- | sysdeps/i386/i686/multiarch/wcslen.S | 37 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/Makefile | 3 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/ifunc-impl-list.c | 4 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/wcslen-i386.c (renamed from sysdeps/i386/i686/multiarch/wcslen-c.c) | 4 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/wcslen-sse2.S (renamed from sysdeps/i386/i686/multiarch/wcslen-sse2.S) | 0 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/wcslen.c | 50 |
7 files changed, 56 insertions, 45 deletions
diff --git a/sysdeps/i386/i686/multiarch/Makefile b/sysdeps/i386/i686/multiarch/Makefile index 57cd608c75..3e078b7ec4 100644 --- a/sysdeps/i386/i686/multiarch/Makefile +++ b/sysdeps/i386/i686/multiarch/Makefile @@ -1,4 +1,3 @@ ifeq ($(subdir),wcsmbs) -sysdep_routines += wcslen-sse2 wcslen-c \ - wmemcmp-sse4 wmemcmp-ssse3 wmemcmp-c +sysdep_routines += wmemcmp-sse4 wmemcmp-ssse3 wmemcmp-c endif diff --git a/sysdeps/i386/i686/multiarch/wcslen.S b/sysdeps/i386/i686/multiarch/wcslen.S deleted file mode 100644 index 7740404a82..0000000000 --- a/sysdeps/i386/i686/multiarch/wcslen.S +++ /dev/null @@ -1,37 +0,0 @@ -/* Multiple versions of wcslen - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2015 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -#if IS_IN (libc) - .text -ENTRY(__wcslen) - .type __wcslen, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__wcslen_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__wcslen_sse2) -2: ret -END(__wcslen) - -weak_alias(__wcslen, wcslen) -#endif diff --git a/sysdeps/i386/multiarch/Makefile b/sysdeps/i386/multiarch/Makefile index d06b2ad9f9..6d594f8611 100644 --- a/sysdeps/i386/multiarch/Makefile +++ b/sysdeps/i386/multiarch/Makefile @@ -51,7 +51,8 @@ endif ifeq ($(subdir),wcsmbs) sysdep_routines += wcschr-i386 wcschr-sse2 wcsrchr-i386 wcsrchr-sse2 \ - wcscmp-i386 wcscmp-sse2 wcscpy-i386 wcscpy-ssse3 + wcscmp-i386 wcscmp-sse2 wcscpy-i386 wcscpy-ssse3 \ + wcslen-i386 wcslen-sse2 endif ifeq (mathyes,$(subdir)$(config-cflags-avx)) diff --git a/sysdeps/i386/multiarch/ifunc-impl-list.c b/sysdeps/i386/multiarch/ifunc-impl-list.c index c5cc501c75..a10e700649 100644 --- a/sysdeps/i386/multiarch/ifunc-impl-list.c +++ b/sysdeps/i386/multiarch/ifunc-impl-list.c @@ -334,13 +334,11 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, __wcscpy_ssse3) IFUNC_IMPL_ADD (array, i, wcscpy, 1, __wcscpy_i386)) -#if 0 /* Support sysdeps/i386/i686/multiarch/wcslen.S. */ IFUNC_IMPL (i, name, wcslen, IFUNC_IMPL_ADD (array, i, wcslen, HAS_CPU_FEATURE (SSE2), __wcslen_sse2) - IFUNC_IMPL_ADD (array, i, wcslen, 1, __wcslen_ia32)) -#endif + IFUNC_IMPL_ADD (array, i, wcslen, 1, __wcslen_i386)) /* Support sysdeps/i386/i686/multiarch/wcsrchr.S. */ IFUNC_IMPL (i, name, wcsrchr, diff --git a/sysdeps/i386/i686/multiarch/wcslen-c.c b/sysdeps/i386/multiarch/wcslen-i386.c index a335dc0f7e..9c7b94e09f 100644 --- a/sysdeps/i386/i686/multiarch/wcslen-c.c +++ b/sysdeps/i386/multiarch/wcslen-i386.c @@ -1,9 +1,9 @@ #include <wchar.h> #if IS_IN (libc) -# define WCSLEN __wcslen_ia32 +# define WCSLEN __wcslen_i386 #endif -extern __typeof (wcslen) __wcslen_ia32; +extern __typeof (wcslen) __wcslen_i386; #include "wcsmbs/wcslen.c" diff --git a/sysdeps/i386/i686/multiarch/wcslen-sse2.S b/sysdeps/i386/multiarch/wcslen-sse2.S index 1c54b1894c..1c54b1894c 100644 --- a/sysdeps/i386/i686/multiarch/wcslen-sse2.S +++ b/sysdeps/i386/multiarch/wcslen-sse2.S diff --git a/sysdeps/i386/multiarch/wcslen.c b/sysdeps/i386/multiarch/wcslen.c new file mode 100644 index 0000000000..4a7970eebc --- /dev/null +++ b/sysdeps/i386/multiarch/wcslen.c @@ -0,0 +1,50 @@ +/* Multiple versions of wcslen. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +/* Redefine wcslen so that the compiler won't complain about the type + mismatch with the IFUNC selector in strong_alias, below. */ +# undef wcslen +# define wcslen __redirect_wcslen +# include <wchar.h> +# undef wcslen + +# include <init-arch.h> + +extern __typeof (__redirect_wcslen) __wcslen_i386 attribute_hidden; +extern __typeof (__redirect_wcslen) __wcslen_sse2 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +extern __typeof (__redirect_wcslen) __wcslen; +extern void *wcslen_ifunc (void) __asm__ ("__wcslen"); + +void * +wcslen_ifunc (void) +{ + if (HAS_CPU_FEATURE (SSE2)) + return __wcslen_sse2; + + return __wcslen_i386; +} +__asm__ (".type __wcslen, %gnu_indirect_function"); + +weak_alias (__wcslen, wcslen) +#endif |