From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id EC0543858C50; Thu, 9 Feb 2023 11:40:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC0543858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675942830; bh=22XqmH8HkvLK1+hjuTMfA2TxaL3tPRhvRTBD0IzsjtA=; h=From:To:Subject:Date:From; b=KaifNw6Tj5w6PYK3Giuab6Ghj2ml0zvZvz7Dzz2BrO22CV9upD8o89tZ/nhqQJ3Xo kJpDsbKgHOQOthONBkMy9nzVvar/PV9bwqQltSNFBYL6i9KBJPSe7iS9IPsOHlqgkB M4z7bDIXifMitIC3wLmWDewb/G4XO1pBWDlimBvs= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc] string: Add libc_hidden_proto for strchrnul X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/master X-Git-Oldrev: 9fd63e35371b9939e9153907c6a753e6960b68ad X-Git-Newrev: 7ea510127e2067efa07865158ac92c330c379950 Message-Id: <20230209114030.EC0543858C50@sourceware.org> Date: Thu, 9 Feb 2023 11:40:30 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7ea510127e2067efa07865158ac92c330c379950 commit 7ea510127e2067efa07865158ac92c330c379950 Author: Adhemerval Zanella Date: Mon Feb 6 13:15:22 2023 -0300 string: Add libc_hidden_proto for strchrnul Although static linker can optimize it to local call, it follows the internal scheme to provide hidden proto and definitions. Reviewed-by: Carlos Eduardo Seo Diff: --- include/string.h | 1 + string/strchrnul.c | 1 + sysdeps/aarch64/strchrnul.S | 1 + sysdeps/i386/strchrnul.S | 1 + sysdeps/m68k/strchrnul.S | 1 + .../powerpc32/power4/multiarch/strchrnul-ppc32.c | 7 +++++++ sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c | 17 +++++++++-------- sysdeps/powerpc/powerpc64/multiarch/strchrnul.c | 1 + sysdeps/s390/strchrnul-c.c | 4 +++- sysdeps/s390/strchrnul.c | 8 +++++--- sysdeps/x86_64/multiarch/strchrnul.c | 4 ++++ sysdeps/x86_64/strchrnul.S | 1 + 12 files changed, 35 insertions(+), 12 deletions(-) diff --git a/include/string.h b/include/string.h index 21f641a413..6e364e8a67 100644 --- a/include/string.h +++ b/include/string.h @@ -95,6 +95,7 @@ libc_hidden_proto (__rawmemchr) libc_hidden_proto (__strcasecmp) libc_hidden_proto (__strcasecmp_l) libc_hidden_proto (__strncasecmp_l) +libc_hidden_proto (__strchrnul) extern __typeof (strncat) __strncat; libc_hidden_proto (__strncat) libc_hidden_proto (__strdup) diff --git a/string/strchrnul.c b/string/strchrnul.c index e7887fa285..01fa25bdb7 100644 --- a/string/strchrnul.c +++ b/string/strchrnul.c @@ -51,5 +51,6 @@ __strchrnul (const char *str, int c_in) return (char *) word_ptr + index_first_zero_eq (word, repeated_c); } #ifndef STRCHRNUL +libc_hidden_def (__strchrnul) weak_alias (__strchrnul, strchrnul) #endif diff --git a/sysdeps/aarch64/strchrnul.S b/sysdeps/aarch64/strchrnul.S index aa8c9a4363..00ce463439 100644 --- a/sysdeps/aarch64/strchrnul.S +++ b/sysdeps/aarch64/strchrnul.S @@ -95,4 +95,5 @@ L(end): ret END(__strchrnul) +libc_hidden_def (__strchrnul) weak_alias (__strchrnul, strchrnul) diff --git a/sysdeps/i386/strchrnul.S b/sysdeps/i386/strchrnul.S index a4fa7469d6..274e83534c 100644 --- a/sysdeps/i386/strchrnul.S +++ b/sysdeps/i386/strchrnul.S @@ -273,4 +273,5 @@ L(6): popl %edi /* restore saved register content */ ret END (__strchrnul) +libc_hidden_def (__strchrnul) weak_alias (__strchrnul, strchrnul) diff --git a/sysdeps/m68k/strchrnul.S b/sysdeps/m68k/strchrnul.S index f4759a0fb3..1aee431f41 100644 --- a/sysdeps/m68k/strchrnul.S +++ b/sysdeps/m68k/strchrnul.S @@ -263,4 +263,5 @@ L(L9:) rts END(__strchrnul) +libc_hidden_def (__strchrnul) weak_alias (__strchrnul, strchrnul) diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul-ppc32.c b/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul-ppc32.c index da03ac7c04..fbd947def1 100644 --- a/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul-ppc32.c +++ b/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul-ppc32.c @@ -22,3 +22,10 @@ extern __typeof (strchrnul) __strchrnul_ppc attribute_hidden; #include +#undef __strchrnul +weak_alias (__strchrnul_ppc, __strchrnul) +#ifdef SHARED +__hidden_ver1 (__strchrnul_ppc, __GI___strchrnul, __strchrnul_ppc); +#else +weak_alias (__strchrnul_ppc, strchrnul) +#endif diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c b/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c index d17dfa4fcf..b11e2a4ff7 100644 --- a/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c +++ b/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c @@ -16,22 +16,23 @@ License along with the GNU C Library; if not, see . */ -#if IS_IN (libc) +#if defined SHARED && IS_IN (libc) +# define __strchrnul __redirect___strchrnul +# define strchrnul __redirect_strchrnul # include # include # include "init-arch.h" extern __typeof (__strchrnul) __strchrnul_ppc attribute_hidden; extern __typeof (__strchrnul) __strchrnul_power7 attribute_hidden; +# undef __strchrnul +# undef strchrnul /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle ifunc symbol properly. */ -libc_ifunc (__strchrnul, - (hwcap & PPC_FEATURE_HAS_VSX) - ? __strchrnul_power7 - : __strchrnul_ppc); - +libc_ifunc_redirected (__redirect___strchrnul, __strchrnul, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __strchrnul_power7 + : __strchrnul_ppc); weak_alias (__strchrnul, strchrnul) -#else -#include #endif diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c b/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c index a901fa3c45..94873507a6 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c +++ b/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c @@ -35,6 +35,7 @@ libc_ifunc (__strchrnul, ? __strchrnul_power7 : __strchrnul_ppc); +libc_hidden_def (__strchrnul) weak_alias (__strchrnul, strchrnul) #else #include diff --git a/sysdeps/s390/strchrnul-c.c b/sysdeps/s390/strchrnul-c.c index ff6aa38d4f..f6f5bae311 100644 --- a/sysdeps/s390/strchrnul-c.c +++ b/sysdeps/s390/strchrnul-c.c @@ -21,8 +21,10 @@ #if HAVE_STRCHRNUL_C # if HAVE_STRCHRNUL_IFUNC # define STRCHRNUL STRCHRNUL_C -# define __strchrnul STRCHRNUL # endif # include +# if defined SHARED && IS_IN (libc) +__hidden_ver1 (__strchrnul_c, __GI___strchrnul, __strchrnul_c); +# endif #endif diff --git a/sysdeps/s390/strchrnul.c b/sysdeps/s390/strchrnul.c index a480d28356..e86ba6db75 100644 --- a/sysdeps/s390/strchrnul.c +++ b/sysdeps/s390/strchrnul.c @@ -19,18 +19,20 @@ #include #if HAVE_STRCHRNUL_IFUNC +# define __strchrnul __redirect_strchrnul # include +# undef __strchrnul # include # if HAVE_STRCHRNUL_C -extern __typeof (__strchrnul) STRCHRNUL_C attribute_hidden; +extern __typeof (__redirect_strchrnul) STRCHRNUL_C attribute_hidden; # endif # if HAVE_STRCHRNUL_Z13 -extern __typeof (__strchrnul) STRCHRNUL_Z13 attribute_hidden; +extern __typeof (__redirect_strchrnul) STRCHRNUL_Z13 attribute_hidden; # endif -s390_libc_ifunc_expr (__strchrnul, __strchrnul, +s390_libc_ifunc_expr (__redirect_strchrnul, __strchrnul, (HAVE_STRCHRNUL_Z13 && (hwcap & HWCAP_S390_VX)) ? STRCHRNUL_Z13 : STRCHRNUL_DEFAULT diff --git a/sysdeps/x86_64/multiarch/strchrnul.c b/sysdeps/x86_64/multiarch/strchrnul.c index be9221bb31..69d691631a 100644 --- a/sysdeps/x86_64/multiarch/strchrnul.c +++ b/sysdeps/x86_64/multiarch/strchrnul.c @@ -31,4 +31,8 @@ libc_ifunc_redirected (__redirect_strchrnul, __strchrnul, IFUNC_SELECTOR ()); weak_alias (__strchrnul, strchrnul) +# ifdef SHARED +__hidden_ver1 (__strchrnul, __GI___strchrnul, __redirect_strchrnul) + __attribute__((visibility ("hidden"))) __attribute_copy__ (strchrnul); +# endif #endif diff --git a/sysdeps/x86_64/strchrnul.S b/sysdeps/x86_64/strchrnul.S index 02cfcba263..07df9a5b06 100644 --- a/sysdeps/x86_64/strchrnul.S +++ b/sysdeps/x86_64/strchrnul.S @@ -24,4 +24,5 @@ #include "isa-default-impl.h" +libc_hidden_def (__strchrnul) weak_alias (__strchrnul, strchrnul)