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 <carlos.seo@linaro.org>
This commit is contained in:
Adhemerval Zanella 2023-02-06 13:15:22 -03:00
parent 9fd63e3537
commit 7ea510127e
12 changed files with 35 additions and 12 deletions

View 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)

View 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

View File

@ -95,4 +95,5 @@ L(end):
ret
END(__strchrnul)
libc_hidden_def (__strchrnul)
weak_alias (__strchrnul, strchrnul)

View File

@ -273,4 +273,5 @@ L(6): popl %edi /* restore saved register content */
ret
END (__strchrnul)
libc_hidden_def (__strchrnul)
weak_alias (__strchrnul, strchrnul)

View File

@ -263,4 +263,5 @@ L(L9:)
rts
END(__strchrnul)
libc_hidden_def (__strchrnul)
weak_alias (__strchrnul, strchrnul)

View File

@ -22,3 +22,10 @@
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

View File

@ -16,22 +16,23 @@
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

View 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>

View File

@ -21,8 +21,10 @@
#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

View File

@ -19,18 +19,20 @@
#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

View 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

View File

@ -24,4 +24,5 @@
#include "isa-default-impl.h"
libc_hidden_def (__strchrnul)
weak_alias (__strchrnul, strchrnul)