Patchwork [13/20] libcpu-rt-c/x86-64: Add strcpy

login
register
mail settings
Submitter H.J. Lu
Date June 12, 2018, 10:19 p.m.
Message ID <20180612221939.19545-14-hjl.tools@gmail.com>
Download mbox | patch
Permalink /patch/27769/
State New
Headers show

Comments

H.J. Lu - June 12, 2018, 10:19 p.m.
* sysdeps/x86_64/Makefile (cpu-rt-c-routines): Add strcpy.
	* sysdeps/x86_64/multiarch/Makefile
	(libcpu-rt-c-sysdep_routines): Add strcpy-sse2,
	strcpy-sse2-unaligned and strcpy-ssse3.
	* sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S: Support
	libcpu-rt-c.
	* sysdeps/x86_64/multiarch/strcpy-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strcpy-ssse3.S: Likewise.
	* sysdeps/x86_64/multiarch/strcpy.c: Likewise.
---
 sysdeps/x86_64/Makefile                          | 2 +-
 sysdeps/x86_64/multiarch/Makefile                | 3 ++-
 sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S | 2 +-
 sysdeps/x86_64/multiarch/strcpy-sse2.S           | 2 +-
 sysdeps/x86_64/multiarch/strcpy-ssse3.S          | 2 +-
 sysdeps/x86_64/multiarch/strcpy.c                | 4 ++--
 6 files changed, 8 insertions(+), 7 deletions(-)

Patch

diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
index dbd2d5e6df..b793d067f2 100644
--- a/sysdeps/x86_64/Makefile
+++ b/sysdeps/x86_64/Makefile
@@ -148,7 +148,7 @@  endif
 
 ifeq ($(subdir),cpu-rt-c)
 cpu-rt-c-routines += memchr memcmp memcpy memmove mempcpy memrchr \
-		     memset strchr strcmp \
+		     memset strchr strcmp strcpy \
 		     wmemset
 
 # For the CPU run-time tests.
diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile
index c1cf7d89fa..c6040a0170 100644
--- a/sysdeps/x86_64/multiarch/Makefile
+++ b/sysdeps/x86_64/multiarch/Makefile
@@ -84,5 +84,6 @@  libcpu-rt-c-sysdep_routines += memchr-sse2 memchr-avx2 \
 			       strchr-sse2-no-bsf strchr-sse2 \
 			       strchr-avx2 strcmp-sse2 \
 			       strcmp-sse2-unaligned strcmp-ssse3 \
-			       strcmp-sse4_2 strcmp-avx2
+			       strcmp-sse4_2 strcmp-avx2 strcpy-sse2 \
+			       strcpy-sse2-unaligned strcpy-ssse3
 endif
diff --git a/sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S b/sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S
index 56b748eb2c..8ae7bd3cc3 100644
--- a/sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S
+++ b/sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S
@@ -17,7 +17,7 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#if IS_IN (libc)
+#if IS_IN (libc) || IS_IN (libcpu_rt_c)
 
 # ifndef USE_AS_STRCAT
 #  include <sysdep.h>
diff --git a/sysdeps/x86_64/multiarch/strcpy-sse2.S b/sysdeps/x86_64/multiarch/strcpy-sse2.S
index 70136017fa..c6cd2434ef 100644
--- a/sysdeps/x86_64/multiarch/strcpy-sse2.S
+++ b/sysdeps/x86_64/multiarch/strcpy-sse2.S
@@ -16,7 +16,7 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#if IS_IN (libc)
+#if IS_IN (libc) || IS_IN (libcpu_rt_c)
 
 # include <sysdep.h>
 # define strcpy __strcpy_sse2
diff --git a/sysdeps/x86_64/multiarch/strcpy-ssse3.S b/sysdeps/x86_64/multiarch/strcpy-ssse3.S
index 9858d0c4d5..d000fc2494 100644
--- a/sysdeps/x86_64/multiarch/strcpy-ssse3.S
+++ b/sysdeps/x86_64/multiarch/strcpy-ssse3.S
@@ -17,7 +17,7 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#if IS_IN (libc)
+#if IS_IN (libc) || IS_IN (libcpu_rt_c)
 
 # ifndef USE_AS_STRCAT
 #  include <sysdep.h>
diff --git a/sysdeps/x86_64/multiarch/strcpy.c b/sysdeps/x86_64/multiarch/strcpy.c
index 12e0e3ffe2..ccfa151085 100644
--- a/sysdeps/x86_64/multiarch/strcpy.c
+++ b/sysdeps/x86_64/multiarch/strcpy.c
@@ -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 strcpy __redirect_strcpy
 # include <string.h>
 # undef strcpy
@@ -28,7 +28,7 @@ 
 
 libc_ifunc_redirected (__redirect_strcpy, strcpy, IFUNC_SELECTOR ());
 
-# ifdef SHARED
+# if defined SHARED && !IS_IN (libcpu_rt_c)
 __hidden_ver1 (strcpy, __GI_strcpy, __redirect_strcpy)
   __attribute__ ((visibility ("hidden")));
 # endif