1 /* Multiple versions of strcmp
2 All versions must be listed in ifunc-impl-list.c.
3 Copyright (C) 2010-2017 Free Software Foundation, Inc.
4 Contributed by Intel Corporation.
5 This file is part of the GNU C Library.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, see
19 <http://www.gnu.org/licenses/>. */
22 #include <init-arch.h>
25 # define STRCMP strncmp
26 # define __GI_STRCMP __GI_strncmp
27 # define __STRCMP_IA32 __strncmp_ia32
28 # define __STRCMP_SSSE3 __strncmp_ssse3
29 # define __STRCMP_SSE4_2 __strncmp_sse4_2
30 #elif defined USE_AS_STRCASECMP_L
31 # define STRCMP __strcasecmp_l
32 # define __GI_STRCMP __GI_strcasecmp_l
33 # define __STRCMP_IA32 __strcasecmp_l_ia32
34 # define __STRCMP_SSSE3 __strcasecmp_l_ssse3
35 # define __STRCMP_SSE4_2 __strcasecmp_l_sse4_2
36 #elif defined USE_AS_STRNCASECMP_L
37 # define STRCMP __strncasecmp_l
38 # define __GI_STRCMP __GI_strncasecmp_l
39 # define __STRCMP_IA32 __strncasecmp_l_ia32
40 # define __STRCMP_SSSE3 __strncasecmp_l_ssse3
41 # define __STRCMP_SSE4_2 __strncasecmp_l_sse4_2
43 # define STRCMP strcmp
44 # define __GI_STRCMP __GI_strcmp
45 # define __STRCMP_IA32 __strcmp_ia32
46 # define __STRCMP_SSSE3 __strcmp_ssse3
47 # define __STRCMP_SSE4_2 __strcmp_sse4_2
50 /* Define multiple versions only for the definition in libc. Don't
51 define multiple versions for strncmp in static library since we
52 need strncmp before the initialization happened. */
53 #if (defined SHARED || !defined USE_AS_STRNCMP) && IS_IN (libc)
56 .type STRCMP, @gnu_indirect_function
57 LOAD_GOT_AND_RTLD_GLOBAL_RO
58 LOAD_FUNC_GOT_EAX (__STRCMP_IA32)
59 HAS_CPU_FEATURE (SSSE3)
61 LOAD_FUNC_GOT_EAX (__STRCMP_SSSE3)
62 HAS_CPU_FEATURE (SSE4_2)
64 HAS_ARCH_FEATURE (Slow_SSE4_2)
66 LOAD_FUNC_GOT_EAX (__STRCMP_SSE4_2)
71 # define ENTRY(name) \
72 .type __STRCMP_IA32, @function; \
74 .globl __STRCMP_IA32; \
75 .hidden __STRCMP_IA32; \
76 __STRCMP_IA32: cfi_startproc; \
80 cfi_endproc; .size __STRCMP_IA32, .-__STRCMP_IA32
83 # undef libc_hidden_builtin_def
84 /* IFUNC doesn't work with the hidden functions in shared library since
85 they will be called without setting up EBX needed for PLT which is
87 # define libc_hidden_builtin_def(name) \
88 .globl __GI_STRCMP; __GI_STRCMP = __STRCMP_IA32
92 #if !defined USE_AS_STRNCMP && !defined USE_AS_STRCASECMP_L \
93 && !defined USE_AS_STRNCASECMP_L
94 # include "../strcmp.S"