| 1 | /* Multiple versions of strstr. |
| 2 | All versions must be listed in ifunc-impl-list.c. |
| 3 | Copyright (C) 2012-2021 Free Software Foundation, Inc. |
| 4 | This file is part of the GNU C Library. |
| 5 | |
| 6 | The GNU C Library is free software; you can redistribute it and/or |
| 7 | modify it under the terms of the GNU Lesser General Public |
| 8 | License as published by the Free Software Foundation; either |
| 9 | version 2.1 of the License, or (at your option) any later version. |
| 10 | |
| 11 | The GNU C Library is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | Lesser General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU Lesser General Public |
| 17 | License along with the GNU C Library; if not, see |
| 18 | <https://www.gnu.org/licenses/>. */ |
| 19 | |
| 20 | /* Redefine strstr so that the compiler won't complain about the type |
| 21 | mismatch with the IFUNC selector in strong_alias, below. */ |
| 22 | #undef strstr |
| 23 | #define strstr __redirect_strstr |
| 24 | #include <string.h> |
| 25 | #undef strstr |
| 26 | |
| 27 | #define STRSTR __strstr_sse2 |
| 28 | #ifdef SHARED |
| 29 | # undef libc_hidden_builtin_def |
| 30 | # define libc_hidden_builtin_def(name) \ |
| 31 | __hidden_ver1 (__strstr_sse2, __GI_strstr, __strstr_sse2); |
| 32 | #endif |
| 33 | |
| 34 | #include "string/strstr.c" |
| 35 | |
| 36 | extern __typeof (__redirect_strstr) __strstr_sse2_unaligned attribute_hidden; |
| 37 | extern __typeof (__redirect_strstr) __strstr_sse2 attribute_hidden; |
| 38 | |
| 39 | #include "init-arch.h" |
| 40 | |
| 41 | /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle |
| 42 | ifunc symbol properly. */ |
| 43 | extern __typeof (__redirect_strstr) __libc_strstr; |
| 44 | libc_ifunc (__libc_strstr, |
| 45 | HAS_ARCH_FEATURE (Fast_Unaligned_Load) |
| 46 | ? __strstr_sse2_unaligned |
| 47 | : __strstr_sse2) |
| 48 | |
| 49 | #undef strstr |
| 50 | strong_alias (__libc_strstr, strstr) |
| 51 | |