[15/20] libcpu-rt-c/x86-64: Add strcat

Message ID 20180612221939.19545-16-hjl.tools@gmail.com
State New, archived
Headers

Commit Message

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

Patch

diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
index 947cb48086..ea0d7a31dc 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 strcpy strlen \
+		     memset strcat strchr strcmp strcpy strlen \
 		     wmemset
 
 # For the CPU run-time tests.
diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile
index b2f0e9f8da..10de1f3af3 100644
--- a/sysdeps/x86_64/multiarch/Makefile
+++ b/sysdeps/x86_64/multiarch/Makefile
@@ -81,6 +81,8 @@  libcpu-rt-c-sysdep_routines += memchr-sse2 memchr-avx2 \
 			       memset-avx2-unaligned-erms \
 			       memset-avx512-unaligned-erms \
 			       memset-avx512-no-vzeroupper \
+			       strcat-sse2 strcat-sse2-unaligned \
+			       strcat-ssse3 \
 			       strchr-sse2-no-bsf strchr-sse2 \
 			       strchr-avx2 strcmp-sse2 \
 			       strcmp-sse2-unaligned strcmp-ssse3 \
diff --git a/sysdeps/x86_64/multiarch/strcat-sse2-unaligned.S b/sysdeps/x86_64/multiarch/strcat-sse2-unaligned.S
index 852f179bf4..d144651b33 100644
--- a/sysdeps/x86_64/multiarch/strcat-sse2-unaligned.S
+++ b/sysdeps/x86_64/multiarch/strcat-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)
 
 # include <sysdep.h>
 
diff --git a/sysdeps/x86_64/multiarch/strcat-sse2.S b/sysdeps/x86_64/multiarch/strcat-sse2.S
index 8eb64e104c..f4939ac409 100644
--- a/sysdeps/x86_64/multiarch/strcat-sse2.S
+++ b/sysdeps/x86_64/multiarch/strcat-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 strcat __strcat_sse2
diff --git a/sysdeps/x86_64/multiarch/strcat-ssse3.S b/sysdeps/x86_64/multiarch/strcat-ssse3.S
index 2d4fd78f99..65e8b8e6a4 100644
--- a/sysdeps/x86_64/multiarch/strcat-ssse3.S
+++ b/sysdeps/x86_64/multiarch/strcat-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)
 
 # include <sysdep.h>
 
diff --git a/sysdeps/x86_64/multiarch/strcat.c b/sysdeps/x86_64/multiarch/strcat.c
index 1f7f6263f3..8637e249ec 100644
--- a/sysdeps/x86_64/multiarch/strcat.c
+++ b/sysdeps/x86_64/multiarch/strcat.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 strcat __redirect_strcat
 # include <string.h>
 # undef strcat
@@ -28,7 +28,7 @@ 
 
 libc_ifunc_redirected (__redirect_strcat, strcat, IFUNC_SELECTOR ());
 
-# ifdef SHARED
+# if defined SHARED && !IS_IN (libcpu_rt_c)
 __hidden_ver1 (strcat, __GI_strcat, __redirect_strcat)
   __attribute__ ((visibility ("hidden")));
 # endif
diff --git a/sysdeps/x86_64/strcat.S b/sysdeps/x86_64/strcat.S
index 9a4a4e6feb..db2a6e881a 100644
--- a/sysdeps/x86_64/strcat.S
+++ b/sysdeps/x86_64/strcat.S
@@ -255,4 +255,6 @@  ENTRY (strcat)
 	movq	%rdi, %rax	/* Source is return value.  */
 	retq
 END (strcat)
+#if !IS_IN (libcpu_rt_c)
 libc_hidden_builtin_def (strcat)
+#endif