public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] powerpc: Remove duplicate strchrnul and strncasecmp_l libc.a (BZ 31786)
@ 2024-05-22 14:32 Adhemerval Zanella
  2024-05-22 14:37 ` H.J. Lu
  0 siblings, 1 reply; 2+ messages in thread
From: Adhemerval Zanella @ 2024-05-22 14:32 UTC (permalink / raw)
  To: libc-alpha; +Cc: H . J . Lu

For powerpc64 the generic version provides a weak definition of
strchrnul, which are already provided by the ifunc resolver.  The
powerpc32 version is slight different, where for static case there
is no iFUNC support.

The strncasecmp_l is provided ifunc resolver.

Checked on powerpc-linux-gnu-power4 and powerpc64-linux-gnu.
---
 .../powerpc/powerpc64/multiarch/strchrnul-power7.S |  3 +++
 .../powerpc/powerpc64/multiarch/strchrnul-ppc64.c  | 14 +++++++++++++-
 .../powerpc64/multiarch/strncase_l-power7.c        |  3 +++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S b/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S
index 384edce8b9..fc784c2856 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S
@@ -18,6 +18,9 @@
 
 #define STRCHRNUL __strchrnul_power7
 
+#undef weak_alias
+#define weak_alias(a,b)
+
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
 
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchrnul-ppc64.c b/sysdeps/powerpc/powerpc64/multiarch/strchrnul-ppc64.c
index 8e42504efe..7127972250 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strchrnul-ppc64.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/strchrnul-ppc64.c
@@ -16,4 +16,16 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul-ppc32.c>
+#include <string.h>
+
+#if IS_IN (libc)
+# define STRCHRNUL  __strchrnul_ppc
+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);
+# endif
+#endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncase_l-power7.c b/sysdeps/powerpc/powerpc64/multiarch/strncase_l-power7.c
index 1587079580..664ce44345 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strncase_l-power7.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/strncase_l-power7.c
@@ -19,6 +19,9 @@
 
 #define __strncasecmp_l __strncasecmp_l_power7
 
+#undef weak_alias
+#define weak_alias(a,b)
+
 #undef libc_hidden_def
 #define libc_hidden_def(name)
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc: Remove duplicate strchrnul and strncasecmp_l libc.a (BZ 31786)
  2024-05-22 14:32 [PATCH] powerpc: Remove duplicate strchrnul and strncasecmp_l libc.a (BZ 31786) Adhemerval Zanella
@ 2024-05-22 14:37 ` H.J. Lu
  0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 2024-05-22 14:37 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Wed, May 22, 2024 at 7:32 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> For powerpc64 the generic version provides a weak definition of
> strchrnul, which are already provided by the ifunc resolver.  The
> powerpc32 version is slight different, where for static case there
> is no iFUNC support.
>
> The strncasecmp_l is provided ifunc resolver.
>
> Checked on powerpc-linux-gnu-power4 and powerpc64-linux-gnu.
> ---
>  .../powerpc/powerpc64/multiarch/strchrnul-power7.S |  3 +++
>  .../powerpc/powerpc64/multiarch/strchrnul-ppc64.c  | 14 +++++++++++++-
>  .../powerpc64/multiarch/strncase_l-power7.c        |  3 +++
>  3 files changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S b/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S
> index 384edce8b9..fc784c2856 100644
> --- a/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S
> +++ b/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S
> @@ -18,6 +18,9 @@
>
>  #define STRCHRNUL __strchrnul_power7
>
> +#undef weak_alias
> +#define weak_alias(a,b)
> +
>  #undef libc_hidden_builtin_def
>  #define libc_hidden_builtin_def(name)
>
> diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchrnul-ppc64.c b/sysdeps/powerpc/powerpc64/multiarch/strchrnul-ppc64.c
> index 8e42504efe..7127972250 100644
> --- a/sysdeps/powerpc/powerpc64/multiarch/strchrnul-ppc64.c
> +++ b/sysdeps/powerpc/powerpc64/multiarch/strchrnul-ppc64.c
> @@ -16,4 +16,16 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>
> -#include <sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul-ppc32.c>
> +#include <string.h>
> +
> +#if IS_IN (libc)
> +# define STRCHRNUL  __strchrnul_ppc
> +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);
> +# endif
> +#endif
> diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncase_l-power7.c b/sysdeps/powerpc/powerpc64/multiarch/strncase_l-power7.c
> index 1587079580..664ce44345 100644
> --- a/sysdeps/powerpc/powerpc64/multiarch/strncase_l-power7.c
> +++ b/sysdeps/powerpc/powerpc64/multiarch/strncase_l-power7.c
> @@ -19,6 +19,9 @@
>
>  #define __strncasecmp_l __strncasecmp_l_power7
>
> +#undef weak_alias
> +#define weak_alias(a,b)
> +
>  #undef libc_hidden_def
>  #define libc_hidden_def(name)
>
> --
> 2.43.0
>

LGTM.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-22 14:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-22 14:32 [PATCH] powerpc: Remove duplicate strchrnul and strncasecmp_l libc.a (BZ 31786) Adhemerval Zanella
2024-05-22 14:37 ` H.J. Lu

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