public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: libc-alpha@sourceware.org
Subject: [PATCH 20/20] libcpu-rt-c/x86-64: Add strrchr
Date: Tue, 12 Jun 2018 22:20:00 -0000	[thread overview]
Message-ID: <20180612221939.19545-21-hjl.tools@gmail.com> (raw)
In-Reply-To: <20180612221939.19545-1-hjl.tools@gmail.com>

	* sysdeps/x86_64/Makefile (cpu-rt-c-routines): Add strrchr.
	* sysdeps/x86_64/multiarch/Makefile
	(libcpu-rt-c-sysdep_routines): strrchr-sse2 and strrchr-avx2.
	* sysdeps/x86_64/multiarch/strrchr-avx2.S: Support libcpu-rt-c.
	* sysdeps/x86_64/multiarch/strrchr-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strrchr.c: Likewise.
---
 sysdeps/x86_64/Makefile                 | 2 +-
 sysdeps/x86_64/multiarch/Makefile       | 2 +-
 sysdeps/x86_64/multiarch/strrchr-avx2.S | 2 +-
 sysdeps/x86_64/multiarch/strrchr-sse2.S | 2 +-
 sysdeps/x86_64/multiarch/strrchr.c      | 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
index 17d3a07894..267ce17e42 100644
--- a/sysdeps/x86_64/Makefile
+++ b/sysdeps/x86_64/Makefile
@@ -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 strncmp strncpy \
+		     strnlen strncmp strncpy strrchr \
 		     wmemset
 
 # For the CPU run-time tests.
diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile
index de4938b3eb..08a578e1a3 100644
--- a/sysdeps/x86_64/multiarch/Makefile
+++ b/sysdeps/x86_64/multiarch/Makefile
@@ -93,5 +93,5 @@ libcpu-rt-c-sysdep_routines += memchr-sse2 memchr-avx2 \
 			       strnlen-sse2 strnlen-avx2 strncmp-sse2 \
 			       strncmp-ssse3 strncmp-sse4_2 strncmp-avx2 \
 			       strncpy-c strncpy-sse2-unaligned \
-			       strncpy-ssse3
+			       strncpy-ssse3 strrchr-sse2 strrchr-avx2
 endif
diff --git a/sysdeps/x86_64/multiarch/strrchr-avx2.S b/sysdeps/x86_64/multiarch/strrchr-avx2.S
index 4381e6ab3e..78347b6bf7 100644
--- a/sysdeps/x86_64/multiarch/strrchr-avx2.S
+++ b/sysdeps/x86_64/multiarch/strrchr-avx2.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>
 
diff --git a/sysdeps/x86_64/multiarch/strrchr-sse2.S b/sysdeps/x86_64/multiarch/strrchr-sse2.S
index 0ec76fe9cc..0f6678f642 100644
--- a/sysdeps/x86_64/multiarch/strrchr-sse2.S
+++ b/sysdeps/x86_64/multiarch/strrchr-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)
 # define strrchr __strrchr_sse2
 
 # undef weak_alias
diff --git a/sysdeps/x86_64/multiarch/strrchr.c b/sysdeps/x86_64/multiarch/strrchr.c
index a719edde10..6c44acb42d 100644
--- a/sysdeps/x86_64/multiarch/strrchr.c
+++ b/sysdeps/x86_64/multiarch/strrchr.c
@@ -17,7 +17,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 strrchr __redirect_strrchr
 # include <string.h>
 # undef strrchr
@@ -27,7 +27,7 @@
 
 libc_ifunc_redirected (__redirect_strrchr, strrchr, IFUNC_SELECTOR ());
 weak_alias (strrchr, rindex);
-# ifdef SHARED
+# if defined SHARED && !IS_IN (libcpu_rt_c)
 __hidden_ver1 (strrchr, __GI_strrchr, __redirect_strrchr)
   __attribute__((visibility ("hidden")));
 # endif
-- 
2.17.1

  parent reply	other threads:[~2018-06-12 22:20 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-12 22:19 [PATCH 00/20] RFC: Add the CPU run-time library for C H.J. Lu
2018-06-12 22:19 ` [PATCH 03/20] libcpu-rt-c/x86: Add cpu-rt-tunables.c H.J. Lu
2018-06-12 22:19 ` [PATCH 02/20] libcpu-rt-c/x86: Add cacheinfo H.J. Lu
2018-06-12 22:19 ` [PATCH 04/20] libcpu-rt-c/x86-64: Add memchr H.J. Lu
2018-06-12 22:19 ` [PATCH 08/20] libcpu-rt-c/x86-64: Add memset and wmemset H.J. Lu
2018-06-12 22:19 ` [PATCH 07/20] libcpu-rt-c/x86-64: Add memrchr H.J. Lu
2018-06-12 22:20 ` [PATCH 09/20] libcpu-rt-c/i386: Add memcmp H.J. Lu
2018-06-12 22:20 ` [PATCH 05/20] libcpu-rt-c/x86-64: " H.J. Lu
2018-06-12 22:20 ` [PATCH 19/20] libcpu-rt-c/x86-64: Add strncpy H.J. Lu
2018-06-12 22:20 ` [PATCH 10/20] libcpu-rt-c: Don't use IFUNC memcmp in init_cpu_features H.J. Lu
2018-06-12 22:20 ` [PATCH 17/20] libcpu-rt-c/x86-64: Add strncat H.J. Lu
2018-06-12 22:20 ` [PATCH 14/20] libcpu-rt-c/x86-64: Add strlen H.J. Lu
2018-06-12 22:20 ` [PATCH 13/20] libcpu-rt-c/x86-64: Add strcpy H.J. Lu
2018-06-12 22:20 ` [PATCH 18/20] libcpu-rt-c/x86-64: Add strncmp H.J. Lu
2018-06-12 22:20 ` [PATCH 11/20] libcpu-rt-c/x86-64: Add strchr H.J. Lu
2018-06-12 22:20 ` [PATCH 16/20] libcpu-rt-c/x86-64: Add strnlen H.J. Lu
2018-06-12 22:20 ` [PATCH 15/20] libcpu-rt-c/x86-64: Add strcat H.J. Lu
2018-06-12 22:20 ` H.J. Lu [this message]
2018-06-12 22:20 ` [PATCH 01/20] Initial empty CPU run-time library for C: libcpu-rt-c H.J. Lu
2018-06-12 23:21   ` Joseph Myers
2018-06-13 11:21     ` H.J. Lu
2018-06-12 22:20 ` [PATCH 06/20] libcpu-rt-c/x86-64: Add memcpy, memmove and mempcpy H.J. Lu
2018-06-12 22:20 ` [PATCH 12/20] libcpu-rt-c/x86-64: Add strcmp H.J. Lu
2018-06-13  6:50 ` [PATCH 00/20] RFC: Add the CPU run-time library for C Florian Weimer
2018-06-13 10:14   ` H.J. Lu
2018-06-13 12:03     ` Adhemerval Zanella
2018-06-13 12:31       ` H.J. Lu
2018-06-13 13:25     ` Florian Weimer
2018-06-13 13:41       ` H.J. Lu
2018-06-13 14:20       ` Siddhesh Poyarekar
2018-06-18 13:42         ` Florian Weimer
2018-06-19  8:20           ` Siddhesh Poyarekar
2018-06-18 17:09 ` Carlos O'Donell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180612221939.19545-21-hjl.tools@gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).