From patchwork Tue Jun 12 22:19:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 27775 Received: (qmail 94268 invoked by alias); 12 Jun 2018 22:20:05 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 93241 invoked by uid 89); 12 Jun 2018 22:19:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy= X-HELO: mga01.intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: "H.J. Lu" To: libc-alpha@sourceware.org Subject: [PATCH 17/20] libcpu-rt-c/x86-64: Add strncat Date: Tue, 12 Jun 2018 15:19:36 -0700 Message-Id: <20180612221939.19545-18-hjl.tools@gmail.com> In-Reply-To: <20180612221939.19545-1-hjl.tools@gmail.com> References: <20180612221939.19545-1-hjl.tools@gmail.com> * sysdeps/x86_64/Makefile (cpu-rt-c-routines): Add strncat. * sysdeps/x86_64/multiarch/Makefile (libcpu-rt-c-sysdep_routines): Add strncat-sse2-unaligned, strncat-ssse3, strnlen-sse2 and strnlen-avx2, * sysdeps/x86_64/strncat.c: New file. * sysdeps/x86_64/multiarch/strncat-c.c: Support libcpu-rt-c. * sysdeps/x86_64/multiarch/strncat.c: Likewise. --- sysdeps/x86_64/Makefile | 3 ++- sysdeps/x86_64/multiarch/Makefile | 3 ++- sysdeps/x86_64/multiarch/strncat-c.c | 2 +- sysdeps/x86_64/multiarch/strncat.c | 6 ++++-- sysdeps/x86_64/strncat.c | 9 +++++++++ 5 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 sysdeps/x86_64/strncat.c diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile index 1a5720bbac..3c9ea605c6 100644 --- a/sysdeps/x86_64/Makefile +++ b/sysdeps/x86_64/Makefile @@ -148,7 +148,8 @@ endif ifeq ($(subdir),cpu-rt-c) cpu-rt-c-routines += memchr memcmp memcpy memmove mempcpy memrchr \ - memset strcat strchr strcmp strcpy strlen strnlen \ + memset strcat strchr strcmp strcpy strlen strncat \ + strnlen \ wmemset # For the CPU run-time tests. diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile index 1c902eec4e..c9ae280f43 100644 --- a/sysdeps/x86_64/multiarch/Makefile +++ b/sysdeps/x86_64/multiarch/Makefile @@ -88,6 +88,7 @@ libcpu-rt-c-sysdep_routines += memchr-sse2 memchr-avx2 \ strcmp-sse2-unaligned strcmp-ssse3 \ strcmp-sse4_2 strcmp-avx2 strcpy-sse2 \ strcpy-sse2-unaligned strcpy-ssse3 \ - strlen-sse2 strlen-avx2 \ + strlen-sse2 strlen-avx2 strncat-c \ + strncat-sse2-unaligned strncat-ssse3 \ strnlen-sse2 strnlen-avx2 endif diff --git a/sysdeps/x86_64/multiarch/strncat-c.c b/sysdeps/x86_64/multiarch/strncat-c.c index 93a7fab7ea..eb08e80d2e 100644 --- a/sysdeps/x86_64/multiarch/strncat-c.c +++ b/sysdeps/x86_64/multiarch/strncat-c.c @@ -1,2 +1,2 @@ #define STRNCAT __strncat_sse2 -#include +#include diff --git a/sysdeps/x86_64/multiarch/strncat.c b/sysdeps/x86_64/multiarch/strncat.c index 841c165565..8bfc54a472 100644 --- a/sysdeps/x86_64/multiarch/strncat.c +++ b/sysdeps/x86_64/multiarch/strncat.c @@ -18,7 +18,7 @@ . */ /* Define multiple versions only for the definition in libc. */ -#if IS_IN (libc) +#if IS_IN (libc) || IS_IN (libcpu_rt_c) # define strncat __redirect_strncat # include # undef strncat @@ -27,9 +27,11 @@ # include "ifunc-unaligned-ssse3.h" libc_ifunc_redirected (__redirect_strncat, strncat, IFUNC_SELECTOR ()); +# if !IS_IN (libcpu_rt_c) strong_alias (strncat, __strncat); -# ifdef SHARED +# ifdef SHARED __hidden_ver1 (strncat, __GI___strncat, __redirect_strncat) __attribute__((visibility ("hidden"))); +# endif # endif #endif diff --git a/sysdeps/x86_64/strncat.c b/sysdeps/x86_64/strncat.c new file mode 100644 index 0000000000..ad6885514a --- /dev/null +++ b/sysdeps/x86_64/strncat.c @@ -0,0 +1,9 @@ +#if IS_IN (libcpu_rt_c) +# include +extern __typeof (strnlen) __strnlen attribute_hidden; +# ifndef STRNCAT +# define STRNCAT strncat +# endif +#endif + +#include