]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
string: Add libc_hidden_proto for strchrnul
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 6 Feb 2023 16:15:22 +0000 (13:15 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 8 Feb 2023 20:13:56 +0000 (17:13 -0300)
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 <carlos.seo@linaro.org>
12 files changed:
include/string.h
string/strchrnul.c
sysdeps/aarch64/strchrnul.S
sysdeps/i386/strchrnul.S
sysdeps/m68k/strchrnul.S
sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul-ppc32.c
sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c
sysdeps/powerpc/powerpc64/multiarch/strchrnul.c
sysdeps/s390/strchrnul-c.c
sysdeps/s390/strchrnul.c
sysdeps/x86_64/multiarch/strchrnul.c
sysdeps/x86_64/strchrnul.S

index 21f641a413918ff4ae18ab2e85a6f66367a4f96c..6e364e8a67617a860ca6169b65acd1c7871c42b9 100644 (file)
@@ -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)
index e7887fa28500caf9c6089865172284296b52547a..01fa25bdb7136acdee728b5bad5fc77127f20e8d 100644 (file)
@@ -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
index aa8c9a4363051b4098c2f60ee830bab7326a54a7..00ce46343942caa158980eeabc1d9ed01b9a7772 100644 (file)
@@ -95,4 +95,5 @@ L(end):
        ret
 
 END(__strchrnul)
+libc_hidden_def (__strchrnul)
 weak_alias (__strchrnul, strchrnul)
index a4fa7469d6131efb1da9b41d661e1e41bfdae025..274e83534ca0629ccb3b9d74eff31a3ed2ed5673 100644 (file)
@@ -273,4 +273,5 @@ L(6):       popl %edi               /* restore saved register content */
        ret
 END (__strchrnul)
 
+libc_hidden_def (__strchrnul)
 weak_alias (__strchrnul, strchrnul)
index f4759a0fb3701fd5b484492364babc5ca48ba00d..1aee431f41d4c56ae66a3086fe7c6d2b23f0df78 100644 (file)
@@ -263,4 +263,5 @@ L(L9:)
        rts
 END(__strchrnul)
 
+libc_hidden_def (__strchrnul)
 weak_alias (__strchrnul, strchrnul)
index da03ac7c04261409cac56ea3b324e12abcc465d8..fbd947def1b87b53d34841c636ab58b91a8f119b 100644 (file)
 extern __typeof (strchrnul) __strchrnul_ppc attribute_hidden;
 
 #include <string/strchrnul.c>
+#undef __strchrnul
+weak_alias (__strchrnul_ppc, __strchrnul)
+#ifdef SHARED
+__hidden_ver1 (__strchrnul_ppc, __GI___strchrnul, __strchrnul_ppc);
+#else
+weak_alias (__strchrnul_ppc, strchrnul)
+#endif
index d17dfa4fcfe3e09206e6f543c436b04df91e9b99..b11e2a4ff7c188881106957859a70db4ba43b23b 100644 (file)
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#if IS_IN (libc)
+#if defined SHARED && IS_IN (libc)
+# define __strchrnul __redirect___strchrnul
+# define strchrnul __redirect_strchrnul
 # include <string.h>
 # include <shlib-compat.h>
 # 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 <string/strchrnul.c>
 #endif
index a901fa3c45d6787604c74996af49b6fa696c9761..94873507a663b3fab844d8cfa925d585e623438b 100644 (file)
@@ -35,6 +35,7 @@ libc_ifunc (__strchrnul,
             ? __strchrnul_power7
             : __strchrnul_ppc);
 
+libc_hidden_def (__strchrnul)
 weak_alias (__strchrnul, strchrnul)
 #else
 #include <string/strchrnul.c>
index ff6aa38d4f6eb2ffb8f5ab6bcbc2a1c7edef813d..f6f5bae3111ca783ab6913355740db1658cb0d88 100644 (file)
 #if HAVE_STRCHRNUL_C
 # if HAVE_STRCHRNUL_IFUNC
 #  define STRCHRNUL STRCHRNUL_C
-#  define __strchrnul STRCHRNUL
 # endif
 
 # include <string/strchrnul.c>
+# if defined SHARED && IS_IN (libc)
+__hidden_ver1 (__strchrnul_c, __GI___strchrnul, __strchrnul_c);
+# endif
 #endif
index a480d283561f47a3280485e061209f839b2721f9..e86ba6db75509e3f9eb7f01c8c66de021f811568 100644 (file)
 #include <ifunc-strchrnul.h>
 
 #if HAVE_STRCHRNUL_IFUNC
+# define __strchrnul __redirect_strchrnul
 # include <string.h>
+# undef __strchrnul
 # include <ifunc-resolve.h>
 
 # 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
index be9221bb31ef1df1abe6cc1eaa3618f1e6ec0ffa..69d691631a0fcab20069e117965be2a21829fe2e 100644 (file)
@@ -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
index 02cfcba2631abf6d21706f3b8b0c6fdb42600a91..07df9a5b069f3284dc5c18e5460556c0d74c9358 100644 (file)
@@ -24,4 +24,5 @@
 
 #include "isa-default-impl.h"
 
+libc_hidden_def (__strchrnul)
 weak_alias (__strchrnul, strchrnul)