[v1,1/6] String: Add __memcmpeq as build target

Message ID 20211027024323.1199441-1-goldstein.w.n@gmail.com
State Committed
Commit 3592ccd472a47ec8be977b0ff33f841f4c175caf
Headers
Series [v1,1/6] String: Add __memcmpeq as build target |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Noah Goldstein Oct. 27, 2021, 2:43 a.m. UTC
  No bug. This commit just adds __memcmpeq as a build target so that
implementations for __memcmpeq that are not just aliases to memcmp can
be supported.
---
 string/Makefile   |  2 +-
 string/memcmpeq.c | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 string/memcmpeq.c
  

Comments

H.J. Lu Oct. 27, 2021, 12:42 p.m. UTC | #1
On Tue, Oct 26, 2021 at 7:43 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> No bug. This commit just adds __memcmpeq as a build target so that
> implementations for __memcmpeq that are not just aliases to memcmp can
> be supported.
> ---
>  string/Makefile   |  2 +-
>  string/memcmpeq.c | 24 ++++++++++++++++++++++++
>  2 files changed, 25 insertions(+), 1 deletion(-)
>  create mode 100644 string/memcmpeq.c
>
> diff --git a/string/Makefile b/string/Makefile
> index 40d6fac133..2199dd30b7 100644
> --- a/string/Makefile
> +++ b/string/Makefile
> @@ -34,7 +34,7 @@ routines      := strcat strchr strcmp strcoll strcpy strcspn          \
>                    strerror _strerror strlen strnlen                    \
>                    strncat strncmp strncpy                              \
>                    strrchr strpbrk strsignal strspn strstr strtok       \
> -                  strtok_r strxfrm memchr memcmp memmove memset        \
> +                  strtok_r strxfrm memchr memcmp memcmpeq memmove memset       \
>                    mempcpy bcopy bzero ffs ffsll stpcpy stpncpy         \
>                    strcasecmp strncase strcasecmp_l strncase_l          \
>                    memccpy memcpy wordcopy strsep strcasestr            \
> diff --git a/string/memcmpeq.c b/string/memcmpeq.c
> new file mode 100644
> index 0000000000..08726325a8
> --- /dev/null
> +++ b/string/memcmpeq.c
> @@ -0,0 +1,24 @@
> +/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +/* This file is intentionally left empty.  It exists so that both
> +   architectures which implement __memcmpeq seperately from memcmp and
> +   architectures which implement __memcmpeq by having it alias memcmp will
> +   build.
> +
> +   The alias for __memcmpeq to memcmp for the C implementation is in
> +   memcmp.c.  */
> --
> 2.25.1
>

LGTM.

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

Thanks.

H.J.
  
Noah Goldstein Oct. 27, 2021, 6:46 p.m. UTC | #2
On Wed, Oct 27, 2021 at 7:43 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Tue, Oct 26, 2021 at 7:43 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> >
> > No bug. This commit just adds __memcmpeq as a build target so that
> > implementations for __memcmpeq that are not just aliases to memcmp can
> > be supported.
> > ---
> >  string/Makefile   |  2 +-
> >  string/memcmpeq.c | 24 ++++++++++++++++++++++++
> >  2 files changed, 25 insertions(+), 1 deletion(-)
> >  create mode 100644 string/memcmpeq.c
> >
> > diff --git a/string/Makefile b/string/Makefile
> > index 40d6fac133..2199dd30b7 100644
> > --- a/string/Makefile
> > +++ b/string/Makefile
> > @@ -34,7 +34,7 @@ routines      := strcat strchr strcmp strcoll strcpy strcspn          \
> >                    strerror _strerror strlen strnlen                    \
> >                    strncat strncmp strncpy                              \
> >                    strrchr strpbrk strsignal strspn strstr strtok       \
> > -                  strtok_r strxfrm memchr memcmp memmove memset        \
> > +                  strtok_r strxfrm memchr memcmp memcmpeq memmove memset       \
> >                    mempcpy bcopy bzero ffs ffsll stpcpy stpncpy         \
> >                    strcasecmp strncase strcasecmp_l strncase_l          \
> >                    memccpy memcpy wordcopy strsep strcasestr            \
> > diff --git a/string/memcmpeq.c b/string/memcmpeq.c
> > new file mode 100644
> > index 0000000000..08726325a8
> > --- /dev/null
> > +++ b/string/memcmpeq.c
> > @@ -0,0 +1,24 @@
> > +/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
> > +   This file is part of the GNU C Library.
> > +
> > +   The GNU C Library is free software; you can redistribute it and/or
> > +   modify it under the terms of the GNU Lesser General Public
> > +   License as published by the Free Software Foundation; either
> > +   version 2.1 of the License, or (at your option) any later version.
> > +
> > +   The GNU C Library is distributed in the hope that it will be useful,
> > +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > +   Lesser General Public License for more details.
> > +
> > +   You should have received a copy of the GNU Lesser General Public
> > +   License along with the GNU C Library; if not, see
> > +   <https://www.gnu.org/licenses/>.  */
> > +
> > +/* This file is intentionally left empty.  It exists so that both
> > +   architectures which implement __memcmpeq seperately from memcmp and
> > +   architectures which implement __memcmpeq by having it alias memcmp will
> > +   build.
> > +
> > +   The alias for __memcmpeq to memcmp for the C implementation is in
> > +   memcmp.c.  */
> > --
> > 2.25.1
> >
>
> LGTM.
>
> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
>
> Thanks.
>
> H.J.

Thanks. Pushed the patchset.
  
Joseph Myers Oct. 28, 2021, 5:57 p.m. UTC | #3
One of the patches in this series has broken the testsuite build for 
x86_64 --disable-multi-arch.

string/tester.o: in function `test_memcmpeq':
/scratch/jmyers/glibc-bot/src/glibc/string/tester.c:1456: undefined reference to `__memcmpeq'

https://sourceware.org/pipermail/libc-testresults/2021q4/008775.html

(11c88336e3013653d473fd58d8658d0cd30887e3 was OK, 
9b7cfab1802b71763da00982f772208544cf4a95 fails, so it's definitely 
something in this series.)
  
Noah Goldstein Oct. 28, 2021, 6:25 p.m. UTC | #4
On Thu, Oct 28, 2021 at 12:57 PM Joseph Myers <joseph@codesourcery.com> wrote:
>
> One of the patches in this series has broken the testsuite build for
> x86_64 --disable-multi-arch.
>
> string/tester.o: in function `test_memcmpeq':
> /scratch/jmyers/glibc-bot/src/glibc/string/tester.c:1456: undefined reference to `__memcmpeq'
>
> https://sourceware.org/pipermail/libc-testresults/2021q4/008775.html
>
> (11c88336e3013653d473fd58d8658d0cd30887e3 was OK,
> 9b7cfab1802b71763da00982f772208544cf4a95 fails, so it's definitely
> something in this series.)
>

Yup. Was able to reproduce. Sorry only tested build not full xcheck
with --disable-multi-arch.

Have a fix. Testing right now.

> --
> Joseph S. Myers
> joseph@codesourcery.com
  

Patch

diff --git a/string/Makefile b/string/Makefile
index 40d6fac133..2199dd30b7 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -34,7 +34,7 @@  routines	:= strcat strchr strcmp strcoll strcpy strcspn		\
 		   strerror _strerror strlen strnlen			\
 		   strncat strncmp strncpy				\
 		   strrchr strpbrk strsignal strspn strstr strtok	\
-		   strtok_r strxfrm memchr memcmp memmove memset	\
+		   strtok_r strxfrm memchr memcmp memcmpeq memmove memset	\
 		   mempcpy bcopy bzero ffs ffsll stpcpy stpncpy		\
 		   strcasecmp strncase strcasecmp_l strncase_l		\
 		   memccpy memcpy wordcopy strsep strcasestr		\
diff --git a/string/memcmpeq.c b/string/memcmpeq.c
new file mode 100644
index 0000000000..08726325a8
--- /dev/null
+++ b/string/memcmpeq.c
@@ -0,0 +1,24 @@ 
+/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/* This file is intentionally left empty.  It exists so that both
+   architectures which implement __memcmpeq seperately from memcmp and
+   architectures which implement __memcmpeq by having it alias memcmp will
+   build.
+
+   The alias for __memcmpeq to memcmp for the C implementation is in
+   memcmp.c.  */