@@ -147,10 +147,12 @@ endif
endif
ifeq ($(subdir),cpu-rt-c)
-cpu-rt-c-routines += memchr memcmp memcpy memmove mempcpy memrchr
+cpu-rt-c-routines += memchr memcmp memcpy memmove mempcpy memrchr \
+ memset \
+ wmemset
# For the CPU run-time tests.
-vpath %.c $(..)string
+vpath %.c $(..)string $(..)wcsmbs
endif
ifeq ($(subdir),csu)
@@ -47,7 +47,11 @@
#ifndef WMEMSET_SYMBOL
# define WMEMSET_CHK_SYMBOL(p,s) p
-# define WMEMSET_SYMBOL(p,s) __wmemset
+# if IS_IN (libcpu_rt_c)
+# define WMEMSET_SYMBOL(p,s) wmemset
+# else
+# define WMEMSET_SYMBOL(p,s) __wmemset
+# endif
#endif
#include "multiarch/memset-vec-unaligned-erms.S"
@@ -76,5 +76,9 @@ libcpu-rt-c-sysdep_routines += memchr-sse2 memchr-avx2 \
memmove-avx-unaligned-erms \
memmove-avx512-unaligned-erms \
memmove-avx512-no-vzeroupper \
- memrchr-sse2 memrchr-avx2
+ memrchr-sse2 memrchr-avx2 \
+ memset-sse2-unaligned-erms \
+ memset-avx2-unaligned-erms \
+ memset-avx512-unaligned-erms \
+ memset-avx512-no-vzeroupper
endif
@@ -1,4 +1,4 @@
-#if IS_IN (libc)
+#if IS_IN (libc) || IS_IN (libcpu_rt_c)
# define VEC_SIZE 32
# define VEC(i) ymm##i
# define VMOVU vmovdqu
@@ -18,7 +18,7 @@
#include <sysdep.h>
-#if IS_IN (libc)
+#if IS_IN (libc) || IS_IN (libcpu_rt_c)
#include "asm-syntax.h"
#ifndef MEMSET
@@ -27,7 +27,7 @@
#endif
.section .text.avx512,"ax",@progbits
-#if defined PIC
+#if defined PIC && IS_IN (libc)
ENTRY (MEMSET_CHK)
cmpq %rdx, %rcx
jb HIDDEN_JUMPTARGET (__chk_fail)
@@ -1,4 +1,4 @@
-#if IS_IN (libc)
+#if IS_IN (libc) || IS_IN (libcpu_rt_c)
# define VEC_SIZE 64
# define VEC(i) zmm##i
# define VMOVU vmovdqu64
@@ -21,7 +21,7 @@
#include <shlib-compat.h>
#include <init-arch.h>
-#if IS_IN (libc)
+#if IS_IN (libc) || IS_IN (libcpu_rt_c)
# define MEMSET_SYMBOL(p,s) p##_sse2_##s
# define WMEMSET_SYMBOL(p,s) p##_sse2_##s
@@ -30,9 +30,11 @@
# define libc_hidden_builtin_def(name)
# endif
-# undef weak_alias
-# define weak_alias(original, alias) \
+# if !IS_IN (libcpu_rt_c)
+# undef weak_alias
+# define weak_alias(original, alias) \
.weak bzero; bzero = __bzero
+# endif
# undef strong_alias
# define strong_alias(ignored1, ignored2)
@@ -73,18 +73,23 @@
#endif
.section SECTION(.text),"ax",@progbits
-#if VEC_SIZE == 16 && IS_IN (libc)
+#if VEC_SIZE == 16 && (IS_IN (libc) || IS_IN (libcpu_rt_c))
+# if IS_IN (libcpu_rt_c)
+# define __bzero bzero
+# endif
ENTRY (__bzero)
movq %rdi, %rax /* Set return value. */
movq %rsi, %rdx /* Set n. */
pxor %xmm0, %xmm0
jmp L(entry_from_bzero)
END (__bzero)
+# if !IS_IN (libcpu_rt_c)
weak_alias (__bzero, bzero)
+# endif
#endif
-#if IS_IN (libc)
-# if defined SHARED
+#if IS_IN (libc) || IS_IN (libcpu_rt_c)
+# if defined SHARED && IS_IN (libc)
ENTRY_CHK (WMEMSET_CHK_SYMBOL (__wmemset_chk, unaligned))
cmpq %rdx, %rcx
jb HIDDEN_JUMPTARGET (__chk_fail)
@@ -117,14 +122,16 @@ L(entry_from_bzero):
VMOVU %VEC(0), (%rdi)
VZEROUPPER
ret
-#if defined USE_MULTIARCH && IS_IN (libc)
+#if defined USE_MULTIARCH && (IS_IN (libc) || IS_IN (libcpu_rt_c))
END (MEMSET_SYMBOL (__memset, unaligned))
-# if VEC_SIZE == 16
+# if VEC_SIZE == 16 && (IS_IN (libc) || IS_IN (libcpu_rt_c))
+# if IS_IN (libc)
ENTRY (__memset_chk_erms)
cmpq %rdx, %rcx
jb HIDDEN_JUMPTARGET (__chk_fail)
END (__memset_chk_erms)
+# endif
/* Only used to measure performance of REP STOSB. */
ENTRY (__memset_erms)
@@ -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 memset __redirect_memset
# include <string.h>
# undef memset
@@ -28,7 +28,7 @@
libc_ifunc_redirected (__redirect_memset, memset, IFUNC_SELECTOR ());
-# ifdef SHARED
+# if defined SHARED && !IS_IN (libcpu_rt_c)
__hidden_ver1 (memset, __GI_memset, __redirect_memset)
__attribute__ ((visibility ("hidden")));
# endif
@@ -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 wmemset __redirect_wmemset
# define __wmemset __redirect___wmemset
# include <wchar.h>
@@ -28,13 +28,19 @@
# define SYMBOL_NAME wmemset
# include "ifunc-wmemset.h"
+# if IS_IN (libcpu_rt_c)
+# define __wmemset wmemset
+# endif
+
libc_ifunc_redirected (__redirect_wmemset, __wmemset, IFUNC_SELECTOR ());
+# if !IS_IN (libcpu_rt_c)
weak_alias (__wmemset, wmemset)
-# ifdef SHARED
+# ifdef SHARED
__hidden_ver1 (__wmemset, __GI___wmemset, __redirect___wmemset)
__attribute__ ((visibility ("hidden")));
__hidden_ver1 (wmemset, __GI_wmemset, __redirect_wmemset)
__attribute__ ((visibility ("hidden")));
+# endif
# endif
#endif