[18/20] libcpu-rt-c/x86-64: Add strncmp
Commit Message
* sysdeps/x86_64/Makefile (cpu-rt-c-routines): Add strncmp.
* sysdeps/x86_64/multiarch/Makefile
(libcpu-rt-c-sysdep_routines): Add strncmp-sse2, strncmp-ssse3,
strncmp-sse4_2 and strncmp-avx2.
* sysdeps/x86_64/multiarch/strncmp-sse2.S: Also rename STRCMP
to __strncmp_sse2 for libcpu-rt-c.
* sysdeps/x86_64/multiarch/strncmp.c: Support libcpu-rt-c.
---
sysdeps/x86_64/Makefile | 2 +-
sysdeps/x86_64/multiarch/Makefile | 3 ++-
sysdeps/x86_64/multiarch/strncmp-sse2.S | 2 +-
sysdeps/x86_64/multiarch/strncmp.c | 4 ++--
4 files changed, 6 insertions(+), 5 deletions(-)
@@ -149,7 +149,7 @@ endif
ifeq ($(subdir),cpu-rt-c)
cpu-rt-c-routines += memchr memcmp memcpy memmove mempcpy memrchr \
memset strcat strchr strcmp strcpy strlen strncat \
- strnlen \
+ strnlen strncmp \
wmemset
# For the CPU run-time tests.
@@ -90,5 +90,6 @@ libcpu-rt-c-sysdep_routines += memchr-sse2 memchr-avx2 \
strcpy-sse2-unaligned strcpy-ssse3 \
strlen-sse2 strlen-avx2 strncat-c \
strncat-sse2-unaligned strncat-ssse3 \
- strnlen-sse2 strnlen-avx2
+ strnlen-sse2 strnlen-avx2 strncmp-sse2 \
+ strncmp-ssse3 strncmp-sse4_2 strncmp-avx2
endif
@@ -18,7 +18,7 @@
#include <sysdep.h>
-#if IS_IN (libc)
+#if IS_IN (libc) || IS_IN (libcpu_rt_c)
# define STRCMP __strncmp_sse2
# undef libc_hidden_builtin_def
# define libc_hidden_builtin_def(strcmp)
@@ -18,7 +18,7 @@
<http://www.gnu.org/licenses/>. */
/* Define multiple versions only for the definition in libc. */
-#if IS_IN (libc)
+#if IS_IN (libc) || IS_IN (libcpu_rt_c)
# define strncmp __redirect_strncmp
# include <string.h>
# undef strncmp
@@ -53,7 +53,7 @@ IFUNC_SELECTOR (void)
libc_ifunc_redirected (__redirect_strncmp, strncmp, IFUNC_SELECTOR ());
-# ifdef SHARED
+# if defined SHARED && !IS_IN (libcpu_rt_c)
__hidden_ver1 (strncmp, __GI_strncmp, __redirect_strncmp)
__attribute__ ((visibility ("hidden")));
# endif