From 6945c141b21d349aa63fe7d0d0ddeb0f3d01d4ff Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 26 Sep 2012 18:54:26 -0700 Subject: [PATCH 2/6] Add i686 multiarch __libc_func --- ChangeLog.test-ifunc | 12 + sysdeps/i386/i686/multiarch/bcopy.S | 2 + sysdeps/i386/i686/multiarch/bzero.S | 2 + sysdeps/i386/i686/multiarch/libc-func.c | 1135 +++++++++++++++++++++++++++++++ sysdeps/i386/i686/multiarch/memcmp.S | 2 + sysdeps/i386/i686/multiarch/memcpy.S | 2 + sysdeps/i386/i686/multiarch/memmove.S | 2 + sysdeps/i386/i686/multiarch/mempcpy.S | 2 + sysdeps/i386/i686/multiarch/strcat.S | 2 + sysdeps/i386/i686/multiarch/strcmp.S | 2 + sysdeps/i386/i686/multiarch/strcpy.S | 2 + 11 files changed, 1165 insertions(+) create mode 100644 sysdeps/i386/i686/multiarch/libc-func.c diff --git a/ChangeLog.test-ifunc b/ChangeLog.test-ifunc index 45a19f2..be024fe 100644 --- a/ChangeLog.test-ifunc +++ b/ChangeLog.test-ifunc @@ -1,5 +1,17 @@ 2012-09-26 H.J. Lu + * sysdeps/i386/i686/multiarch/bcopy.S (__bcopy_ia32): Make it + global and hidden. + * sysdeps/i386/i686/multiarch/bzero.S (__bzero_ia32): Likewise. + * sysdeps/i386/i686/multiarch/memcmp.S (__memcmp_ia32): Likewise. + * sysdeps/i386/i686/multiarch/memcpy.S (__memcpy_ia32): Likewise. + * sysdeps/i386/i686/multiarch/memmove.S (__memmove_ia32): Likewise. + * sysdeps/i386/i686/multiarch/mempcpy.S (__mempcpy_ia32): Likewise. + * sysdeps/i386/i686/multiarch/strcat.S (STRCAT_IA32): Likewise. + * sysdeps/i386/i686/multiarch/strcmp.S (__STRCMP_IA32): Likewise. + * sysdeps/i386/i686/multiarch/strcpy.S (STRCPY_IA32): Likewise. + * sysdeps/i386/i686/multiarch/libc-func.c: New file. + * Rules (tests): Filter out $(tests-ifunc) if multi-arch isn't enabled. (xtests): Filter out $(xtests-ifunc) if multi-arch isn't enabled. diff --git a/sysdeps/i386/i686/multiarch/bcopy.S b/sysdeps/i386/i686/multiarch/bcopy.S index 9db3424..ca507b0 100644 --- a/sysdeps/i386/i686/multiarch/bcopy.S +++ b/sysdeps/i386/i686/multiarch/bcopy.S @@ -67,6 +67,8 @@ END(bcopy) # define ENTRY(name) \ .type __bcopy_ia32, @function; \ .p2align 4; \ + .globl __bcopy_ia32; \ + .hidden __bcopy_ia32; \ __bcopy_ia32: cfi_startproc; \ CALL_MCOUNT # undef END diff --git a/sysdeps/i386/i686/multiarch/bzero.S b/sysdeps/i386/i686/multiarch/bzero.S index 86db169..2226e7a 100644 --- a/sysdeps/i386/i686/multiarch/bzero.S +++ b/sysdeps/i386/i686/multiarch/bzero.S @@ -67,6 +67,8 @@ END(__bzero) # define ENTRY(name) \ .type __bzero_ia32, @function; \ .p2align 4; \ + .globl __bzero_ia32; \ + .hidden __bzero_ia32; \ __bzero_ia32: cfi_startproc; \ CALL_MCOUNT # undef END diff --git a/sysdeps/i386/i686/multiarch/libc-func.c b/sysdeps/i386/i686/multiarch/libc-func.c new file mode 100644 index 0000000..9cd39a1 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/libc-func.c @@ -0,0 +1,1135 @@ +/* Copyright (C) 2012 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 + . */ + +#include +#include +#include +#include +#include "init-arch.h" + +#define find_memcmp() NULL +#define find_memchr() NULL +#define find_memrchr() NULL +#define find_rawmemchr() NULL +#define find_memcpy() NULL +#define find_memmove() NULL +#define find_mempcpy() NULL +#define find___memcpy_chk() NULL +#define find___memmove_chk() NULL +#define find___mempcpy_chk() NULL +#define find_memset() NULL +#define find_stpcpy() NULL +#define find_stpncpy() NULL +#define find_strcpy() NULL +#define find_strncpy() NULL +#define find_strcasecmp() NULL +#define find_strcasecmp_l() NULL +#define find_strncasecmp() NULL +#define find_strncasecmp_l() NULL +#define find_strcasestr() NULL +#define find_strcat() NULL +#define find_strncat() NULL +#define find_strchr() NULL +#define find_strrchr() NULL +#define find_strcmp() NULL +#define find_strncmp() NULL +#define find_strcspn() NULL +#define find_strlen() NULL +#define find_strnlen() NULL +#define find_strpbrk() NULL +#define find_strspn() NULL +#define find_strstr() NULL +#define find_wcschr() NULL +#define find_wcscmp() NULL +#define find_wcscpy() NULL +#define find_wcslen() NULL +#define find_wcsrchr() NULL +#define find_wmemcmp() NULL + +#ifndef NOT_IN_libc + +extern __typeof (memmove) __memmove_ia32 attribute_hidden; +extern __typeof (memmove) __memmove_ssse3 attribute_hidden; +extern __typeof (memmove) __memmove_ssse3_rep attribute_hidden; + +static struct libc_func_test memmove_list[4]; + +# undef find_memmove + +static struct libc_func_test * +find_memmove (void) +{ + size_t i; + if (HAS_SSSE3) + { + memmove_list[0] = LIBC_FUNC_INIT (__memmove_ssse3_rep); + memmove_list[1] = LIBC_FUNC_INIT (__memmove_ssse3); + i = 2; + } + else + i = 0; + memmove_list[i] = LIBC_FUNC_INIT (__memmove_ia32); + return memmove_list; +} + +extern void *__memmove_chk (void *, const void *, size_t, size_t); +extern __typeof (__memmove_chk) __memmove_chk_ia32 attribute_hidden; +extern __typeof (__memmove_chk) __memmove_chk_ssse3 attribute_hidden; +extern __typeof (__memmove_chk) __memmove_chk_ssse3_rep attribute_hidden; + +static struct libc_func_test __memmove_chk_list[4]; + +# undef find___memmove_chk + +static struct libc_func_test * +find___memmove_chk (void) +{ + size_t i; + if (HAS_SSSE3) + { + __memmove_chk_list[0] = LIBC_FUNC_INIT (__memmove_chk_ssse3_rep); + __memmove_chk_list[1] = LIBC_FUNC_INIT (__memmove_chk_ssse3); + i = 2; + } + else + i = 0; + __memmove_chk_list[i] = LIBC_FUNC_INIT (__memmove_chk_ia32); + return __memmove_chk_list; +} + +extern __typeof (memchr) __memchr_ia32 attribute_hidden; +extern __typeof (memchr) __memchr_sse2 attribute_hidden; +extern __typeof (memchr) __memchr_sse2_bsf attribute_hidden; + +static struct libc_func_test memchr_list[4]; + +# undef find_memchr + +static struct libc_func_test * +find_memchr (void) +{ + size_t i; + if (HAS_SSE2) + { + memchr_list[0] = LIBC_FUNC_INIT (__memchr_sse2_bsf); + memchr_list[1] = LIBC_FUNC_INIT (__memchr_sse2); + i = 2; + } + else + i = 0; + memchr_list[i] = LIBC_FUNC_INIT (__memchr_ia32); + return memchr_list; +} + +extern __typeof (memrchr) __memrchr_ia32 attribute_hidden; +extern __typeof (memrchr) __memrchr_sse2 attribute_hidden; +extern __typeof (memrchr) __memrchr_sse2_bsf attribute_hidden; + +static struct libc_func_test memrchr_list[4]; + +# undef find_memrchr + +static struct libc_func_test * +find_memrchr (void) +{ + size_t i; + if (HAS_SSE2) + { + memrchr_list[0] = LIBC_FUNC_INIT (__memrchr_sse2_bsf); + memrchr_list[1] = LIBC_FUNC_INIT (__memrchr_sse2); + i = 2; + } + else + i = 0; + memrchr_list[i] = LIBC_FUNC_INIT (__memrchr_ia32); + return memrchr_list; +} + +extern __typeof (rawmemchr) __rawmemchr_ia32 attribute_hidden; +extern __typeof (rawmemchr) __rawmemchr_sse2 attribute_hidden; +extern __typeof (rawmemchr) __rawmemchr_sse2_bsf attribute_hidden; + +static struct libc_func_test rawmemchr_list[4]; + +# undef find_rawmemchr + +static struct libc_func_test * +find_rawmemchr (void) +{ + size_t i; + if (HAS_SSE2) + { + rawmemchr_list[0] = LIBC_FUNC_INIT (__rawmemchr_sse2_bsf); + rawmemchr_list[1] = LIBC_FUNC_INIT (__rawmemchr_sse2); + i = 2; + } + else + i = 0; + rawmemchr_list[i] = LIBC_FUNC_INIT (__rawmemchr_ia32); + return rawmemchr_list; +} + +extern __typeof (memcmp) __memcmp_ia32 attribute_hidden; +extern __typeof (memcmp) __memcmp_ssse3 attribute_hidden; +extern __typeof (memcmp) __memcmp_sse4_2 attribute_hidden; + +static struct libc_func_test memcmp_list[4]; + +# undef find_memcmp + +static struct libc_func_test * +find_memcmp (void) +{ + size_t i; + if (HAS_SSE4_2) + { + memcmp_list[0] = LIBC_FUNC_INIT (__memcmp_sse4_2); + i = 1; + } + else + i = 0; + if (HAS_SSSE3) + { + memcmp_list[i] = LIBC_FUNC_INIT (__memcmp_ssse3); + i++; + } + memcmp_list[i] = LIBC_FUNC_INIT (__memcmp_ia32); + return memcmp_list; +} + +extern __typeof (memset) __memset_ia32 attribute_hidden; +extern __typeof (memset) __memset_sse2 attribute_hidden; +extern __typeof (memset) __memset_sse2_rep attribute_hidden; + +static struct libc_func_test memset_list[4]; + +# undef find_memset + +static struct libc_func_test * +find_memset (void) +{ + size_t i; + if (HAS_SSE2) + { + memset_list[0] = LIBC_FUNC_INIT (__memset_sse2_rep); + memset_list[1] = LIBC_FUNC_INIT (__memset_sse2); + i = 2; + } + else + i = 0; + memset_list[i] = LIBC_FUNC_INIT (__memset_ia32); + return memset_list; +} + +extern __typeof (stpcpy) __stpcpy_ia32 attribute_hidden; +extern __typeof (stpcpy) __stpcpy_sse2 attribute_hidden; +extern __typeof (stpcpy) __stpcpy_ssse3 attribute_hidden; + +static struct libc_func_test stpcpy_list[4]; + +# undef find_stpcpy + +static struct libc_func_test * +find_stpcpy (void) +{ + size_t i; + if (HAS_SSSE3) + { + stpcpy_list[0] = LIBC_FUNC_INIT (__stpcpy_ssse3); + i = 1; + } + else + i = 0; + if (HAS_SSE2) + { + stpcpy_list[i] = LIBC_FUNC_INIT (__stpcpy_sse2); + i++; + } + stpcpy_list[i] = LIBC_FUNC_INIT (__stpcpy_ia32); + return stpcpy_list; +} + +extern __typeof (stpncpy) __stpncpy_ia32 attribute_hidden; +extern __typeof (stpncpy) __stpncpy_sse2 attribute_hidden; +extern __typeof (stpncpy) __stpncpy_ssse3 attribute_hidden; + +static struct libc_func_test stpncpy_list[4]; + +# undef find_stpncpy + +static struct libc_func_test * +find_stpncpy (void) +{ + size_t i; + if (HAS_SSSE3) + { + stpncpy_list[0] = LIBC_FUNC_INIT (__stpncpy_ssse3); + i = 1; + } + else + i = 0; + if (HAS_SSE2) + { + stpncpy_list[i] = LIBC_FUNC_INIT (__stpncpy_sse2); + i++; + } + stpncpy_list[i] = LIBC_FUNC_INIT (__stpncpy_ia32); + return stpncpy_list; +} + +extern __typeof (strcpy) __strcpy_ia32 attribute_hidden; +extern __typeof (strcpy) __strcpy_sse2 attribute_hidden; +extern __typeof (strcpy) __strcpy_ssse3 attribute_hidden; + +static struct libc_func_test strcpy_list[4]; + +# undef find_strcpy + +static struct libc_func_test * +find_strcpy (void) +{ + size_t i; + if (HAS_SSSE3) + { + strcpy_list[0] = LIBC_FUNC_INIT (__strcpy_ssse3); + i = 1; + } + else + i = 0; + if (HAS_SSE2) + { + strcpy_list[i] = LIBC_FUNC_INIT (__strcpy_sse2); + i++; + } + strcpy_list[i] = LIBC_FUNC_INIT (__strcpy_ia32); + return strcpy_list; +} + +extern __typeof (strncpy) __strncpy_ia32 attribute_hidden; +extern __typeof (strncpy) __strncpy_sse2 attribute_hidden; +extern __typeof (strncpy) __strncpy_ssse3 attribute_hidden; + +static struct libc_func_test strncpy_list[4]; + +# undef find_strncpy + +static struct libc_func_test * +find_strncpy (void) +{ + size_t i; + if (HAS_SSSE3) + { + strncpy_list[0] = LIBC_FUNC_INIT (__strncpy_ssse3); + i = 1; + } + else + i = 0; + if (HAS_SSE2) + { + strncpy_list[i] = LIBC_FUNC_INIT (__strncpy_sse2); + i++; + } + strncpy_list[i] = LIBC_FUNC_INIT (__strncpy_ia32); + return strncpy_list; +} + +extern __typeof (strcasecmp) __strcasecmp_ia32 attribute_hidden; +extern __typeof (strcasecmp) __strcasecmp_ssse3 attribute_hidden; +extern __typeof (strcasecmp) __strcasecmp_sse4_2 attribute_hidden; + +static struct libc_func_test strcasecmp_list[4]; + +# undef find_strcasecmp + +static struct libc_func_test * +find_strcasecmp (void) +{ + size_t i; + if (HAS_SSE4_2) + { + strcasecmp_list[0] = LIBC_FUNC_INIT (__strcasecmp_sse4_2); + i = 1; + } + else + i = 0; + if (HAS_SSSE3) + { + strcasecmp_list[i] = LIBC_FUNC_INIT (__strcasecmp_ssse3); + i++; + } + strcasecmp_list[i] = LIBC_FUNC_INIT (__strcasecmp_ia32); + return strcasecmp_list; +} + +extern __typeof (strcasecmp_l) __strcasecmp_l_ia32 attribute_hidden; +extern __typeof (strcasecmp_l) __strcasecmp_l_ssse3 attribute_hidden; +extern __typeof (strcasecmp_l) __strcasecmp_l_sse4_2 attribute_hidden; + +static struct libc_func_test strcasecmp_l_list[4]; + +# undef find_strcasecmp_l + +static struct libc_func_test * +find_strcasecmp_l (void) +{ + size_t i; + if (HAS_SSE4_2) + { + strcasecmp_l_list[0] = LIBC_FUNC_INIT (__strcasecmp_l_sse4_2); + i = 1; + } + else + i = 0; + if (HAS_SSSE3) + { + strcasecmp_l_list[i] = LIBC_FUNC_INIT (__strcasecmp_l_ssse3); + i++; + } + strcasecmp_l_list[i] = LIBC_FUNC_INIT (__strcasecmp_l_ia32); + return strcasecmp_l_list; +} + +extern __typeof (strncasecmp) __strncasecmp_ia32 attribute_hidden; +extern __typeof (strncasecmp) __strncasecmp_ssse3 attribute_hidden; +extern __typeof (strncasecmp) __strncasecmp_sse4_2 attribute_hidden; + +static struct libc_func_test strncasecmp_list[4]; + +# undef find_strncasecmp + +static struct libc_func_test * +find_strncasecmp (void) +{ + size_t i; + if (HAS_SSE4_2) + { + strncasecmp_list[0] = LIBC_FUNC_INIT (__strncasecmp_sse4_2); + i = 1; + } + else + i = 0; + if (HAS_SSSE3) + { + strncasecmp_list[i] = LIBC_FUNC_INIT (__strncasecmp_ssse3); + i++; + } + strncasecmp_list[i] = LIBC_FUNC_INIT (__strncasecmp_ia32); + return strncasecmp_list; +} + +extern __typeof (strncasecmp_l) __strncasecmp_l_ia32 attribute_hidden; +extern __typeof (strncasecmp_l) __strncasecmp_l_ssse3 attribute_hidden; +extern __typeof (strncasecmp_l) __strncasecmp_l_sse4_2 attribute_hidden; + +static struct libc_func_test strncasecmp_l_list[4]; + +# undef find_strncasecmp_l + +static struct libc_func_test * +find_strncasecmp_l (void) +{ + size_t i; + if (HAS_SSE4_2) + { + strncasecmp_l_list[0] = LIBC_FUNC_INIT (__strncasecmp_l_sse4_2); + i = 1; + } + else + i = 0; + if (HAS_SSSE3) + { + strncasecmp_list[i] = LIBC_FUNC_INIT (__strncasecmp_l_ssse3); + i++; + } + strncasecmp_list[i] = LIBC_FUNC_INIT (__strncasecmp_l_ia32); + return strncasecmp_list; +} + +extern __typeof (strcasestr) __strcasestr_ia32 attribute_hidden; +extern __typeof (strcasestr) __strcasestr_sse42 attribute_hidden; + +static struct libc_func_test strcasestr_list[3]; + +# undef find_strcasestr + +static struct libc_func_test * +find_strcasestr (void) +{ + size_t i; + if (HAS_SSE4_2) + { + strcasestr_list[0] = LIBC_FUNC_INIT (__strcasestr_sse42); + i = 1; + } + else + i = 0; + strcasestr_list[i] = LIBC_FUNC_INIT (__strcasestr_ia32); + return strcasestr_list; +} + +extern __typeof (strcmp) __strcmp_ia32 attribute_hidden; +extern __typeof (strcmp) __strcmp_ssse3 attribute_hidden; +extern __typeof (strcmp) __strcmp_sse4_2 attribute_hidden; + +static struct libc_func_test strcmp_list[4]; + +# undef find_strcmp + +static struct libc_func_test * +find_strcmp (void) +{ + size_t i; + if (HAS_SSE4_2) + { + strcmp_list[0] = LIBC_FUNC_INIT (__strcmp_sse4_2); + i = 1; + } + else + i = 0; + if (HAS_SSSE3) + { + strcmp_list[i] = LIBC_FUNC_INIT (__strcmp_ssse3); + i++; + } + strcmp_list[i] = LIBC_FUNC_INIT (__strcmp_ia32); + return strcmp_list; +} + +extern __typeof (strcat) __strcat_ia32 attribute_hidden; +extern __typeof (strcat) __strcat_sse2 attribute_hidden; +extern __typeof (strcat) __strcat_ssse3 attribute_hidden; + +static struct libc_func_test strcat_list[4]; + +# undef find_strcat + +static struct libc_func_test * +find_strcat (void) +{ + size_t i; + if (HAS_SSSE3) + { + strcat_list[0] = LIBC_FUNC_INIT (__strcat_ssse3); + i = 1; + } + else + i = 0; + if (HAS_SSE2) + { + strcat_list[i] = LIBC_FUNC_INIT (__strcat_sse2); + i++; + } + strcat_list[i] = LIBC_FUNC_INIT (__strcat_ia32); + return strcat_list; +} + +extern __typeof (strncat) __strncat_ia32 attribute_hidden; +extern __typeof (strncat) __strncat_sse2 attribute_hidden; +extern __typeof (strncat) __strncat_ssse3 attribute_hidden; + +static struct libc_func_test strncat_list[4]; + +# undef find_strncat + +static struct libc_func_test * +find_strncat (void) +{ + size_t i; + if (HAS_SSSE3) + { + strncat_list[0] = LIBC_FUNC_INIT (__strncat_ssse3); + i = 1; + } + else + i = 0; + if (HAS_SSE2) + { + strncat_list[i] = LIBC_FUNC_INIT (__strncat_sse2); + i++; + } + strncat_list[i] = LIBC_FUNC_INIT (__strncat_ia32); + return strncat_list; +} + +extern __typeof (strchr) __strchr_ia32 attribute_hidden; +extern __typeof (strchr) __strchr_sse2 attribute_hidden; +extern __typeof (strchr) __strchr_sse2_bsf attribute_hidden; + +static struct libc_func_test strchr_list[4]; + +# undef find_strchr + +static struct libc_func_test * +find_strchr (void) +{ + size_t i; + if (HAS_SSE2) + { + strchr_list[0] = LIBC_FUNC_INIT (__strchr_sse2_bsf); + strchr_list[1] = LIBC_FUNC_INIT (__strchr_sse2); + i = 2; + } + else + i = 0; + strchr_list[i] = LIBC_FUNC_INIT (__strchr_ia32); + return strchr_list; +} + +extern __typeof (strrchr) __strrchr_ia32 attribute_hidden; +extern __typeof (strrchr) __strrchr_sse2 attribute_hidden; +extern __typeof (strrchr) __strrchr_sse2_bsf attribute_hidden; + +static struct libc_func_test strrchr_list[4]; + +# undef find_strrchr + +static struct libc_func_test * +find_strrchr (void) +{ + size_t i; + if (HAS_SSE2) + { + strrchr_list[0] = LIBC_FUNC_INIT (__strrchr_sse2_bsf); + strrchr_list[1] = LIBC_FUNC_INIT (__strrchr_sse2); + i = 2; + } + else + i = 0; + strrchr_list[i] = LIBC_FUNC_INIT (__strrchr_ia32); + return strrchr_list; +} + +extern __typeof (strcspn) __strcspn_ia32 attribute_hidden; +extern __typeof (strcspn) __strcspn_sse42 attribute_hidden; + +static struct libc_func_test strcspn_list[3]; + +# undef find_strcspn + +static struct libc_func_test * +find_strcspn (void) +{ + size_t i; + if (HAS_SSE4_2) + { + strcspn_list[0] = LIBC_FUNC_INIT (__strcspn_sse42); + i = 1; + } + else + i = 0; + strcspn_list[i] = LIBC_FUNC_INIT (__strcspn_ia32); + return strcspn_list; +} + +extern __typeof (strnlen) __strnlen_ia32 attribute_hidden; +extern __typeof (strnlen) __strnlen_sse2 attribute_hidden; + +static struct libc_func_test strnlen_list[3]; + +# undef find_strnlen + +static struct libc_func_test * +find_strnlen (void) +{ + size_t i; + if (HAS_SSE2) + { + strnlen_list[0] = LIBC_FUNC_INIT (__strnlen_sse2); + i = 1; + } + else + i = 0; + strnlen_list[i] = LIBC_FUNC_INIT (__strnlen_ia32); + return strnlen_list; +} + +extern __typeof (strpbrk) __strpbrk_ia32 attribute_hidden; +extern __typeof (strpbrk) __strpbrk_sse42 attribute_hidden; + +static struct libc_func_test strpbrk_list[3]; + +# undef find_strpbrk + +static struct libc_func_test * +find_strpbrk (void) +{ + size_t i; + if (HAS_SSE4_2) + { + strpbrk_list[0] = LIBC_FUNC_INIT (__strpbrk_sse42); + i = 1; + } + else + i = 0; + strpbrk_list[i] = LIBC_FUNC_INIT (__strpbrk_ia32); + return strpbrk_list; +} + +extern __typeof (strspn) __strspn_ia32 attribute_hidden; +extern __typeof (strspn) __strspn_sse42 attribute_hidden; + +static struct libc_func_test strspn_list[3]; + +# undef find_strspn + +static struct libc_func_test * +find_strspn (void) +{ + size_t i; + if (HAS_SSE4_2) + { + strspn_list[0] = LIBC_FUNC_INIT (__strspn_sse42); + i = 1; + } + else + i = 0; + strspn_list[i] = LIBC_FUNC_INIT (__strspn_ia32); + return strspn_list; +} + +extern __typeof (strstr) __strstr_ia32 attribute_hidden; +extern __typeof (strstr) __strstr_sse42 attribute_hidden; + +static struct libc_func_test strstr_list[3]; + +# undef find_strstr + +static struct libc_func_test * +find_strstr (void) +{ + size_t i; + if (HAS_SSE4_2) + { + strstr_list[0] = LIBC_FUNC_INIT (__strstr_sse42); + i = 1; + } + else + i = 0; + strstr_list[i] = LIBC_FUNC_INIT (__strstr_ia32); + return strstr_list; +} + +extern __typeof (wcschr) __wcschr_ia32 attribute_hidden; +extern __typeof (wcschr) __wcschr_sse2 attribute_hidden; + +static struct libc_func_test wcschr_list[3]; + +# undef find_wcschr + +static struct libc_func_test * +find_wcschr (void) +{ + size_t i; + if (HAS_SSE2) + { + wcschr_list[0] = LIBC_FUNC_INIT (__wcschr_sse2); + i = 1; + } + else + i = 0; + wcschr_list[i] = LIBC_FUNC_INIT (__wcschr_ia32); + return wcschr_list; +} + +extern __typeof (wcscmp) __wcscmp_ia32 attribute_hidden; +extern __typeof (wcscmp) __wcscmp_sse2 attribute_hidden; + +static struct libc_func_test wcscmp_list[3]; + +# undef find_wcscmp + +static struct libc_func_test * +find_wcscmp (void) +{ + size_t i; + if (HAS_SSE2) + { + wcscmp_list[0] = LIBC_FUNC_INIT (__wcscmp_sse2); + i = 1; + } + else + i = 0; + wcscmp_list[i] = LIBC_FUNC_INIT (__wcscmp_ia32); + return wcscmp_list; +} + +extern __typeof (wcscpy) __wcscpy_ia32 attribute_hidden; +extern __typeof (wcscpy) __wcscpy_ssse3 attribute_hidden; + +static struct libc_func_test wcscpy_list[3]; + +# undef find_wcscpy + +static struct libc_func_test * +find_wcscpy (void) +{ + size_t i; + if (HAS_SSSE3) + { + wcscpy_list[0] = LIBC_FUNC_INIT (__wcscpy_ssse3); + i = 1; + } + else + i = 0; + wcscpy_list[i] = LIBC_FUNC_INIT (__wcscpy_ia32); + return wcscpy_list; +} + +extern __typeof (wcslen) __wcslen_ia32 attribute_hidden; +extern __typeof (wcslen) __wcslen_sse2 attribute_hidden; + +static struct libc_func_test wcslen_list[3]; + +# undef find_wcslen + +static struct libc_func_test * +find_wcslen (void) +{ + size_t i; + if (HAS_SSE2) + { + wcslen_list[0] = LIBC_FUNC_INIT (__wcslen_sse2); + i = 1; + } + else + i = 0; + wcslen_list[i] = LIBC_FUNC_INIT (__wcslen_ia32); + return wcslen_list; +} + +extern __typeof (wcsrchr) __wcsrchr_ia32 attribute_hidden; +extern __typeof (wcsrchr) __wcsrchr_sse2 attribute_hidden; + +static struct libc_func_test wcsrchr_list[3]; + +# undef find_wcsrchr + +static struct libc_func_test * +find_wcsrchr (void) +{ + size_t i; + if (HAS_SSE2) + { + wcsrchr_list[0] = LIBC_FUNC_INIT (__wcsrchr_sse2); + i = 1; + } + else + i = 0; + wcsrchr_list[i] = LIBC_FUNC_INIT (__wcsrchr_ia32); + return wcsrchr_list; +} + +extern __typeof (wmemcmp) __wmemcmp_ia32 attribute_hidden; +extern __typeof (wmemcmp) __wmemcmp_ssse3 attribute_hidden; +extern __typeof (wmemcmp) __wmemcmp_sse4_2 attribute_hidden; + +static struct libc_func_test wmemcmp_list[4]; + +# undef find_wmemcmp + +static struct libc_func_test * +find_wmemcmp (void) +{ + size_t i; + if (HAS_SSE4_2) + { + wmemcmp_list[0] = LIBC_FUNC_INIT (__wmemcmp_sse4_2); + i = 1; + } + else + i = 0; + if (HAS_SSSE3) + { + wmemcmp_list[i] = LIBC_FUNC_INIT (__wmemcmp_ssse3); + i++; + } + wmemcmp_list[i] = LIBC_FUNC_INIT (__wmemcmp_ia32); + return wmemcmp_list; +} + +# ifdef SHARED +extern __typeof (memcpy) __memcpy_ia32 attribute_hidden; +extern __typeof (memcpy) __memcpy_ssse3 attribute_hidden; +extern __typeof (memcpy) __memcpy_ssse3_rep attribute_hidden; + +static struct libc_func_test memcpy_list[4]; + +# undef find_memcpy + +static struct libc_func_test * +find_memcpy (void) +{ + size_t i; + if (HAS_SSSE3) + { + memcpy_list[0] = LIBC_FUNC_INIT (__memcpy_ssse3_rep); + memcpy_list[1] = LIBC_FUNC_INIT (__memcpy_ssse3); + i = 2; + } + else + i = 0; + memcpy_list[i] = LIBC_FUNC_INIT (__memcpy_ia32); + return memcpy_list; +} + +extern __typeof (mempcpy) __mempcpy_ia32 attribute_hidden; +extern __typeof (mempcpy) __mempcpy_ssse3 attribute_hidden; +extern __typeof (mempcpy) __mempcpy_ssse3_rep attribute_hidden; + +static struct libc_func_test mempcpy_list[4]; + +# undef find_mempcpy + +static struct libc_func_test * +find_mempcpy (void) +{ + size_t i; + if (HAS_SSSE3) + { + mempcpy_list[0] = LIBC_FUNC_INIT (__mempcpy_ssse3_rep); + mempcpy_list[1] = LIBC_FUNC_INIT (__mempcpy_ssse3); + i = 2; + } + else + i = 0; + mempcpy_list[i] = LIBC_FUNC_INIT (__mempcpy_ia32); + return mempcpy_list; +} + +extern void *__memcpy_chk (void *, const void *, size_t, size_t); +extern __typeof (__memcpy_chk) __memcpy_chk_ia32 attribute_hidden; +extern __typeof (__memcpy_chk) __memcpy_chk_ssse3 attribute_hidden; +extern __typeof (__memcpy_chk) __memcpy_chk_ssse3_rep attribute_hidden; + +static struct libc_func_test __memcpy_chk_list[4]; + +# undef find___memcpy_chk + +static struct libc_func_test * +find___memcpy_chk (void) +{ + size_t i; + if (HAS_SSSE3) + { + __memcpy_chk_list[0] = LIBC_FUNC_INIT (__memcpy_chk_ssse3_rep); + __memcpy_chk_list[1] = LIBC_FUNC_INIT (__memcpy_chk_ssse3); + i = 2; + } + else + i = 0; + __memcpy_chk_list[i] = LIBC_FUNC_INIT (__memcpy_chk_ia32); + return __memcpy_chk_list; +} + +extern void *__mempcpy_chk (void *, const void *, size_t, size_t); +extern __typeof (__mempcpy_chk) __mempcpy_chk_ia32 attribute_hidden; +extern __typeof (__mempcpy_chk) __mempcpy_chk_ssse3 attribute_hidden; +extern __typeof (__mempcpy_chk) __mempcpy_chk_ssse3_rep attribute_hidden; + +static struct libc_func_test __mempcpy_chk_list[4]; + +# undef find___mempcpy_chk + +static struct libc_func_test * +find___mempcpy_chk (void) +{ + size_t i; + if (HAS_SSSE3) + { + __mempcpy_chk_list[0] = LIBC_FUNC_INIT (__mempcpy_chk_ssse3_rep); + __mempcpy_chk_list[1] = LIBC_FUNC_INIT (__mempcpy_chk_ssse3); + i = 2; + } + else + i = 0; + __mempcpy_chk_list[i] = LIBC_FUNC_INIT (__mempcpy_chk_ia32); + return __mempcpy_chk_list; +} + +extern __typeof (strlen) __strlen_ia32 attribute_hidden; +extern __typeof (strlen) __strlen_sse2 attribute_hidden; +extern __typeof (strlen) __strlen_sse2_bsf attribute_hidden; + +static struct libc_func_test strlen_list[4]; + +# undef find_strlen + +static struct libc_func_test * +find_strlen (void) +{ + size_t i; + if (HAS_SSE2) + { + strlen_list[0] = LIBC_FUNC_INIT (__strlen_sse2_bsf); + strlen_list[1] = LIBC_FUNC_INIT (__strlen_sse2); + i = 2; + } + else + i = 0; + strlen_list[i] = LIBC_FUNC_INIT (__strlen_ia32); + return strlen_list; +} + +extern __typeof (strncmp) __strncmp_ia32 attribute_hidden; +extern __typeof (strncmp) __strncmp_ssse3 attribute_hidden; +extern __typeof (strncmp) __strncmp_sse4_2 attribute_hidden; + +static struct libc_func_test strncmp_list[4]; + +# undef find_strncmp + +static struct libc_func_test * +find_strncmp (void) +{ + size_t i; + if (HAS_SSE4_2) + { + strncmp_list[0] = LIBC_FUNC_INIT (__strncmp_sse4_2); + i = 1; + } + else + i = 0; + if (HAS_SSSE3) + { + strncmp_list[i] = LIBC_FUNC_INIT (__strncmp_ssse3); + i++; + } + strncmp_list[i] = LIBC_FUNC_INIT (__strncmp_ia32); + return strncmp_list; +} +# endif /* SHARED */ +#endif /* NOT_IN_libc */ + +struct libc_func_test * +__libc_func (const char *name) +{ + if (strcmp (name, "memcmp") == 0) + return find_memcmp (); + + if (strcmp (name, "memchr") == 0) + return find_memchr (); + + if (strcmp (name, "memrchr") == 0) + return find_memrchr (); + + if (strcmp (name, "rawmemchr") == 0) + return find_rawmemchr (); + + if (strcmp (name, "memcpy") == 0) + return find_memcpy (); + + if (strcmp (name, "memmove") == 0) + return find_memmove (); + + if (strcmp (name, "mempcpy") == 0) + return find_mempcpy (); + + if (strcmp (name, "__memcpy_chk") == 0) + return find___memcpy_chk (); + + if (strcmp (name, "__memmove_chk") == 0) + return find___memmove_chk (); + + if (strcmp (name, "__mempcpy_chk") == 0) + return find___mempcpy_chk (); + + if (strcmp (name, "memset") == 0) + return find_memset (); + + if (strcmp (name, "stpcpy") == 0) + return find_stpcpy (); + + if (strcmp (name, "stpncpy") == 0) + return find_stpncpy (); + + if (strcmp (name, "strcpy") == 0) + return find_strcpy (); + + if (strcmp (name, "strncpy") == 0) + return find_strncpy (); + + if (strcmp (name, "strcasecmp") == 0) + return find_strcasecmp (); + + if (strcmp (name, "strcasecmp_l") == 0) + return find_strcasecmp_l (); + + if (strcmp (name, "strncasecmp") == 0) + return find_strncasecmp (); + + if (strcmp (name, "strncasecmp_l") == 0) + return find_strncasecmp_l (); + + if (strcmp (name, "strcasestr") == 0) + return find_strcasestr (); + + if (strcmp (name, "strcat") == 0) + return find_strcat (); + + if (strcmp (name, "strncat") == 0) + return find_strncat (); + + if (strcmp (name, "strcmp") == 0) + return find_strcmp (); + + if (strcmp (name, "strncmp") == 0) + return find_strncmp (); + + if (strcmp (name, "strchr") == 0) + return find_strchr (); + + if (strcmp (name, "strrchr") == 0) + return find_strrchr (); + + if (strcmp (name, "strcspn") == 0) + return find_strcspn (); + + if (strcmp (name, "strlen") == 0) + return find_strlen (); + + if (strcmp (name, "strnlen") == 0) + return find_strnlen (); + + if (strcmp (name, "strpbrk") == 0) + return find_strpbrk (); + + if (strcmp (name, "strspn") == 0) + return find_strspn (); + + if (strcmp (name, "strstr") == 0) + return find_strstr (); + + if (strcmp (name, "wcschr") == 0) + return find_wcschr (); + + if (strcmp (name, "wcscmp") == 0) + return find_wcscmp (); + + if (strcmp (name, "wcscpy") == 0) + return find_wcscpy (); + + if (strcmp (name, "wcslen") == 0) + return find_wcslen (); + + if (strcmp (name, "wcsrchr") == 0) + return find_wcsrchr (); + + if (strcmp (name, "wmemcmp") == 0) + return find_wmemcmp (); + + return NULL; +} diff --git a/sysdeps/i386/i686/multiarch/memcmp.S b/sysdeps/i386/i686/multiarch/memcmp.S index d8076b9..2756f0c 100644 --- a/sysdeps/i386/i686/multiarch/memcmp.S +++ b/sysdeps/i386/i686/multiarch/memcmp.S @@ -67,6 +67,8 @@ END(memcmp) # define ENTRY(name) \ .type __memcmp_ia32, @function; \ .p2align 4; \ + .globl __memcmp_ia32; \ + .hidden __memcmp_ia32; \ __memcmp_ia32: cfi_startproc; \ CALL_MCOUNT # undef END diff --git a/sysdeps/i386/i686/multiarch/memcpy.S b/sysdeps/i386/i686/multiarch/memcpy.S index 558c04f..646e039 100644 --- a/sysdeps/i386/i686/multiarch/memcpy.S +++ b/sysdeps/i386/i686/multiarch/memcpy.S @@ -51,6 +51,8 @@ END(memcpy) # define ENTRY(name) \ .type __memcpy_ia32, @function; \ .p2align 4; \ + .globl __memcpy_ia32; \ + .hidden __memcpy_ia32; \ __memcpy_ia32: cfi_startproc; \ CALL_MCOUNT # undef END diff --git a/sysdeps/i386/i686/multiarch/memmove.S b/sysdeps/i386/i686/multiarch/memmove.S index b8892c0..de452e3 100644 --- a/sysdeps/i386/i686/multiarch/memmove.S +++ b/sysdeps/i386/i686/multiarch/memmove.S @@ -50,6 +50,8 @@ END(memmove) # define ENTRY(name) \ .type __memmove_ia32, @function; \ .p2align 4; \ + .globl __memmove_ia32; \ + .hidden __memmove_ia32; \ __memmove_ia32: cfi_startproc; \ CALL_MCOUNT # else diff --git a/sysdeps/i386/i686/multiarch/mempcpy.S b/sysdeps/i386/i686/multiarch/mempcpy.S index 95bda46..224fbe4 100644 --- a/sysdeps/i386/i686/multiarch/mempcpy.S +++ b/sysdeps/i386/i686/multiarch/mempcpy.S @@ -51,6 +51,8 @@ END(__mempcpy) # define ENTRY(name) \ .type __mempcpy_ia32, @function; \ .p2align 4; \ + .globl __mempcpy_ia32; \ + .hidden __mempcpy_ia32; \ __mempcpy_ia32: cfi_startproc; \ CALL_MCOUNT # undef END diff --git a/sysdeps/i386/i686/multiarch/strcat.S b/sysdeps/i386/i686/multiarch/strcat.S index e68feca..4bfa21d 100644 --- a/sysdeps/i386/i686/multiarch/strcat.S +++ b/sysdeps/i386/i686/multiarch/strcat.S @@ -94,6 +94,8 @@ END(STRCAT) # define ENTRY(name) \ .type STRCAT_IA32, @function; \ .align 16; \ + .globl STRCAT_IA32; \ + .hidden STRCAT_IA32; \ STRCAT_IA32: cfi_startproc; \ CALL_MCOUNT # undef END diff --git a/sysdeps/i386/i686/multiarch/strcmp.S b/sysdeps/i386/i686/multiarch/strcmp.S index b3b9eb8..a94cd5b 100644 --- a/sysdeps/i386/i686/multiarch/strcmp.S +++ b/sysdeps/i386/i686/multiarch/strcmp.S @@ -95,6 +95,8 @@ END(STRCMP) # define ENTRY(name) \ .type __STRCMP_IA32, @function; \ .p2align 4; \ + .globl __STRCMP_IA32; \ + .hidden __STRCMP_IA32; \ __STRCMP_IA32: cfi_startproc; \ CALL_MCOUNT # undef END diff --git a/sysdeps/i386/i686/multiarch/strcpy.S b/sysdeps/i386/i686/multiarch/strcpy.S index 71eee76..de940dc 100644 --- a/sysdeps/i386/i686/multiarch/strcpy.S +++ b/sysdeps/i386/i686/multiarch/strcpy.S @@ -110,6 +110,8 @@ END(STRCPY) # define ENTRY(name) \ .type STRCPY_IA32, @function; \ .align 16; \ + .globl STRCPY_IA32; \ + .hidden STRCPY_IA32; \ STRCPY_IA32: cfi_startproc; \ CALL_MCOUNT # undef END -- 1.7.11.4