diff mbox series

[v7] String: Add support for __memcmpeq() ABI on all targets

Message ID 20210929151743.3351092-1-goldstein.w.n@gmail.com
State Superseded
Headers show
Series [v7] String: Add support for __memcmpeq() ABI on all targets | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Noah Goldstein Sept. 29, 2021, 3:17 p.m. UTC
No bug.

This commit adds support for __memcmpeq() as a new ABI for all
targets. In this commit __memcmpeq() is implemented only as an alias
to the corresponding targets memcmp() implementation. __memcmpeq() is
added as a new symbol starting with GLIBC_2.35 and defined in string.h
with comments explaining its behavior. Basic tests that it is callable
and works where added in string/tester.c

As discussed in the proposal "Add new ABI '__memcmpeq()' to libc"
__memcmpeq() is essentially a reserved namespace for bcmp(). The means
is shares the same specifications as memcmp() except the return value
for non-equal byte sequences is any non-zero value. This is less
strict than memcmp()'s return value specification and can be better
optimized when a boolean return is all that is needed.

__memcmpeq() is meant to only be called by compilers if they can prove
that the return value of a memcmp() call is only used for its boolean
value.

All tests in string/tester.c passed. As well build succeeds on
x86_64-linux-gnu target.
---
 string/Versions                                  |  3 +++
 string/memcmp.c                                  |  2 ++
 string/string.h                                  | 16 ++++++++++++++++
 string/tester.c                                  | 16 ++++++++++++++++
 sysdeps/aarch64/memcmp.S                         |  2 ++
 sysdeps/csky/abiv2/memcmp.S                      |  1 +
 sysdeps/i386/i686/memcmp.S                       |  2 ++
 sysdeps/i386/i686/multiarch/memcmp.c             |  1 +
 sysdeps/i386/memcmp.S                            |  2 ++
 sysdeps/ia64/memcmp.S                            |  1 +
 sysdeps/mach/hurd/i386/libc.abilist              |  1 +
 sysdeps/powerpc/powerpc32/405/memcmp.S           |  1 +
 sysdeps/powerpc/powerpc32/power4/memcmp.S        |  1 +
 sysdeps/powerpc/powerpc32/power7/memcmp.S        |  1 +
 sysdeps/powerpc/powerpc64/le/power10/memcmp.S    |  1 +
 sysdeps/powerpc/powerpc64/power4/memcmp.S        |  1 +
 sysdeps/powerpc/powerpc64/power7/memcmp.S        |  1 +
 sysdeps/powerpc/powerpc64/power8/memcmp.S        |  1 +
 sysdeps/s390/memcmp-z900.S                       |  1 +
 sysdeps/s390/memcmp.c                            |  1 +
 sysdeps/sparc/sparc64/memcmp.S                   |  2 ++
 sysdeps/unix/sysv/linux/aarch64/libc.abilist     |  1 +
 sysdeps/unix/sysv/linux/alpha/libc.abilist       |  1 +
 sysdeps/unix/sysv/linux/arc/libc.abilist         |  1 +
 sysdeps/unix/sysv/linux/arm/be/libc.abilist      |  1 +
 sysdeps/unix/sysv/linux/arm/le/libc.abilist      |  1 +
 sysdeps/unix/sysv/linux/csky/libc.abilist        |  1 +
 sysdeps/unix/sysv/linux/hppa/libc.abilist        |  1 +
 sysdeps/unix/sysv/linux/i386/libc.abilist        |  1 +
 sysdeps/unix/sysv/linux/ia64/libc.abilist        |  1 +
 .../unix/sysv/linux/m68k/coldfire/libc.abilist   |  1 +
 sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist |  1 +
 .../unix/sysv/linux/microblaze/be/libc.abilist   |  1 +
 .../unix/sysv/linux/microblaze/le/libc.abilist   |  1 +
 .../unix/sysv/linux/mips/mips32/fpu/libc.abilist |  1 +
 .../sysv/linux/mips/mips32/nofpu/libc.abilist    |  1 +
 .../unix/sysv/linux/mips/mips64/n32/libc.abilist |  1 +
 .../unix/sysv/linux/mips/mips64/n64/libc.abilist |  1 +
 sysdeps/unix/sysv/linux/nios2/libc.abilist       |  1 +
 .../linux/powerpc/powerpc32/fpu/libc.abilist     |  1 +
 .../linux/powerpc/powerpc32/nofpu/libc.abilist   |  1 +
 .../sysv/linux/powerpc/powerpc64/be/libc.abilist |  1 +
 .../sysv/linux/powerpc/powerpc64/le/libc.abilist |  1 +
 sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist  |  1 +
 sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist  |  1 +
 .../unix/sysv/linux/s390/s390-32/libc.abilist    |  1 +
 .../unix/sysv/linux/s390/s390-64/libc.abilist    |  1 +
 sysdeps/unix/sysv/linux/sh/be/libc.abilist       |  1 +
 sysdeps/unix/sysv/linux/sh/le/libc.abilist       |  1 +
 .../unix/sysv/linux/sparc/sparc32/libc.abilist   |  1 +
 .../unix/sysv/linux/sparc/sparc64/libc.abilist   |  1 +
 sysdeps/unix/sysv/linux/x86_64/64/libc.abilist   |  1 +
 sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist  |  1 +
 sysdeps/x86_64/memcmp.S                          |  2 ++
 sysdeps/x86_64/multiarch/memcmp.c                |  2 ++
 55 files changed, 94 insertions(+)

Comments

Noah Goldstein Sept. 30, 2021, 7:31 p.m. UTC | #1
On Wed, Sep 29, 2021 at 10:17 AM Noah Goldstein <goldstein.w.n@gmail.com>
wrote:

> No bug.
>
> This commit adds support for __memcmpeq() as a new ABI for all
> targets. In this commit __memcmpeq() is implemented only as an alias
> to the corresponding targets memcmp() implementation. __memcmpeq() is
> added as a new symbol starting with GLIBC_2.35 and defined in string.h
> with comments explaining its behavior. Basic tests that it is callable
> and works where added in string/tester.c
>
> As discussed in the proposal "Add new ABI '__memcmpeq()' to libc"
> __memcmpeq() is essentially a reserved namespace for bcmp(). The means
> is shares the same specifications as memcmp() except the return value
> for non-equal byte sequences is any non-zero value. This is less
> strict than memcmp()'s return value specification and can be better
> optimized when a boolean return is all that is needed.
>
> __memcmpeq() is meant to only be called by compilers if they can prove
> that the return value of a memcmp() call is only used for its boolean
> value.
>
> All tests in string/tester.c passed. As well build succeeds on
> x86_64-linux-gnu target.
> ---
>  string/Versions                                  |  3 +++
>  string/memcmp.c                                  |  2 ++
>  string/string.h                                  | 16 ++++++++++++++++
>  string/tester.c                                  | 16 ++++++++++++++++
>  sysdeps/aarch64/memcmp.S                         |  2 ++
>  sysdeps/csky/abiv2/memcmp.S                      |  1 +
>  sysdeps/i386/i686/memcmp.S                       |  2 ++
>  sysdeps/i386/i686/multiarch/memcmp.c             |  1 +
>  sysdeps/i386/memcmp.S                            |  2 ++
>  sysdeps/ia64/memcmp.S                            |  1 +
>  sysdeps/mach/hurd/i386/libc.abilist              |  1 +
>  sysdeps/powerpc/powerpc32/405/memcmp.S           |  1 +
>  sysdeps/powerpc/powerpc32/power4/memcmp.S        |  1 +
>  sysdeps/powerpc/powerpc32/power7/memcmp.S        |  1 +
>  sysdeps/powerpc/powerpc64/le/power10/memcmp.S    |  1 +
>  sysdeps/powerpc/powerpc64/power4/memcmp.S        |  1 +
>  sysdeps/powerpc/powerpc64/power7/memcmp.S        |  1 +
>  sysdeps/powerpc/powerpc64/power8/memcmp.S        |  1 +
>  sysdeps/s390/memcmp-z900.S                       |  1 +
>  sysdeps/s390/memcmp.c                            |  1 +
>  sysdeps/sparc/sparc64/memcmp.S                   |  2 ++
>  sysdeps/unix/sysv/linux/aarch64/libc.abilist     |  1 +
>  sysdeps/unix/sysv/linux/alpha/libc.abilist       |  1 +
>  sysdeps/unix/sysv/linux/arc/libc.abilist         |  1 +
>  sysdeps/unix/sysv/linux/arm/be/libc.abilist      |  1 +
>  sysdeps/unix/sysv/linux/arm/le/libc.abilist      |  1 +
>  sysdeps/unix/sysv/linux/csky/libc.abilist        |  1 +
>  sysdeps/unix/sysv/linux/hppa/libc.abilist        |  1 +
>  sysdeps/unix/sysv/linux/i386/libc.abilist        |  1 +
>  sysdeps/unix/sysv/linux/ia64/libc.abilist        |  1 +
>  .../unix/sysv/linux/m68k/coldfire/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist |  1 +
>  .../unix/sysv/linux/microblaze/be/libc.abilist   |  1 +
>  .../unix/sysv/linux/microblaze/le/libc.abilist   |  1 +
>  .../unix/sysv/linux/mips/mips32/fpu/libc.abilist |  1 +
>  .../sysv/linux/mips/mips32/nofpu/libc.abilist    |  1 +
>  .../unix/sysv/linux/mips/mips64/n32/libc.abilist |  1 +
>  .../unix/sysv/linux/mips/mips64/n64/libc.abilist |  1 +
>  sysdeps/unix/sysv/linux/nios2/libc.abilist       |  1 +
>  .../linux/powerpc/powerpc32/fpu/libc.abilist     |  1 +
>  .../linux/powerpc/powerpc32/nofpu/libc.abilist   |  1 +
>  .../sysv/linux/powerpc/powerpc64/be/libc.abilist |  1 +
>  .../sysv/linux/powerpc/powerpc64/le/libc.abilist |  1 +
>  sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist  |  1 +
>  sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist  |  1 +
>  .../unix/sysv/linux/s390/s390-32/libc.abilist    |  1 +
>  .../unix/sysv/linux/s390/s390-64/libc.abilist    |  1 +
>  sysdeps/unix/sysv/linux/sh/be/libc.abilist       |  1 +
>  sysdeps/unix/sysv/linux/sh/le/libc.abilist       |  1 +
>  .../unix/sysv/linux/sparc/sparc32/libc.abilist   |  1 +
>  .../unix/sysv/linux/sparc/sparc64/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/x86_64/64/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist  |  1 +
>  sysdeps/x86_64/memcmp.S                          |  2 ++
>  sysdeps/x86_64/multiarch/memcmp.c                |  2 ++
>  55 files changed, 94 insertions(+)
>
> diff --git a/string/Versions b/string/Versions
> index 298ecd401a..864c4cf7a4 100644
> --- a/string/Versions
> +++ b/string/Versions
> @@ -89,4 +89,7 @@ libc {
>      sigdescr_np; sigabbrev_np;
>      strerrordesc_np; strerrorname_np;
>    }
> +  GLIBC_2.35 {
> +    __memcmpeq;
> +  }
>  }
> diff --git a/string/memcmp.c b/string/memcmp.c
> index 9b46d7a905..5020be00e0 100644
> --- a/string/memcmp.c
> +++ b/string/memcmp.c
> @@ -358,4 +358,6 @@ libc_hidden_builtin_def(memcmp)
>  #ifdef weak_alias
>  # undef bcmp
>  weak_alias (memcmp, bcmp)
> +# undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  #endif
> diff --git a/string/string.h b/string/string.h
> index 04e1b7067d..d0b714f836 100644
> --- a/string/string.h
> +++ b/string/string.h
> @@ -64,6 +64,22 @@ extern void *memset (void *__s, int __c, size_t __n)
> __THROW __nonnull ((1));
>  extern int memcmp (const void *__s1, const void *__s2, size_t __n)
>       __THROW __attribute_pure__ __nonnull ((1, 2));
>
> +/* Compare N bytes of S1 and S2.  Return zero if S1 and S2 are equal.
> +   Return some non-zero value otherwise.
> +
> +   Essentially __memcmpeq has the exact same semantics as memcmp
> +   except the return value is less constrained.  memcmp is always a
> +   correct implementation of __memcmpeq.  As well !!memcmp, -memcmp,
> +   or bcmp are correct implementations.
> +
> +   __memcmpeq is meant to be used by compilers when memcmp return is
> +   only used for its bolean value.
> +
> +   __memcmpeq is declared only for use by compilers.  Programs should
> +   continue to use memcmp.  */
> +extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n)
> +     __THROW __attribute_pure__ __nonnull ((1, 2));
> +
>  /* Search N bytes of S for C.  */
>  #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
>  extern "C++"
> diff --git a/string/tester.c b/string/tester.c
> index 778160ae6e..605b3f00f9 100644
> --- a/string/tester.c
> +++ b/string/tester.c
> @@ -1449,6 +1449,19 @@ test_bcmp (void)
>    check(bcmp("abc", "def", 0) == 0, 8);        /* Zero count. */
>  }
>
> +static void
> +test_memcmpeq (void)
> +{
> +  it = "__memcmpeq";
> +  check (__memcmpeq ("a", "a", 1) == 0, 1); /* Identity.  */
> +  check (__memcmpeq ("abc", "abc", 3) == 0, 2); /* Multicharacter.  */
> +  check (__memcmpeq ("abcd", "abce", 4) != 0, 3); /* Honestly unequal.  */
> +  check (__memcmpeq ("abce", "abcd", 4) != 0, 4);
> +  check (__memcmpeq ("alph", "beta", 4) != 0, 5);
> +  check (__memcmpeq ("abce", "abcd", 3) == 0, 6); /* Count limited.  */
> +  check (__memcmpeq ("abc", "def", 0) == 0, 8); /* Zero count.  */
> +}
> +
>  static void
>  test_strerror (void)
>  {
> @@ -1611,6 +1624,9 @@ main (void)
>    /* bcmp - somewhat like memcmp.  */
>    test_bcmp ();
>
> +  /* __memcmpeq - somewhat like memcmp.  */
> +  test_memcmpeq ();
> +
>    /* strndup.  */
>    test_strndup ();
>
> diff --git a/sysdeps/aarch64/memcmp.S b/sysdeps/aarch64/memcmp.S
> index c1937f6f5c..bc932eff2a 100644
> --- a/sysdeps/aarch64/memcmp.S
> +++ b/sysdeps/aarch64/memcmp.S
> @@ -177,4 +177,6 @@ L(ret_0):
>  END (memcmp)
>  #undef bcmp
>  weak_alias (memcmp, bcmp)
> +#undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/csky/abiv2/memcmp.S b/sysdeps/csky/abiv2/memcmp.S
> index 1560387618..d61fca0f29 100644
> --- a/sysdeps/csky/abiv2/memcmp.S
> +++ b/sysdeps/csky/abiv2/memcmp.S
> @@ -138,5 +138,6 @@ ENTRY (memcmp)
>         br      .L_s1_aligned
>  END (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_def (memcmp)
>  .weak memcmp
> diff --git a/sysdeps/i386/i686/memcmp.S b/sysdeps/i386/i686/memcmp.S
> index b26b124fad..0194f8deab 100644
> --- a/sysdeps/i386/i686/memcmp.S
> +++ b/sysdeps/i386/i686/memcmp.S
> @@ -405,4 +405,6 @@ L(table_32bytes) :
>
>  #undef bcmp
>  weak_alias (memcmp, bcmp)
> +#undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/i386/i686/multiarch/memcmp.c
> b/sysdeps/i386/i686/multiarch/memcmp.c
> index 6e058a8857..956fc8e601 100644
> --- a/sysdeps/i386/i686/multiarch/memcmp.c
> +++ b/sysdeps/i386/i686/multiarch/memcmp.c
> @@ -29,4 +29,5 @@
>  libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR ());
>
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
>  #endif
> diff --git a/sysdeps/i386/memcmp.S b/sysdeps/i386/memcmp.S
> index 1f212b0f6d..18e225f963 100644
> --- a/sysdeps/i386/memcmp.S
> +++ b/sysdeps/i386/memcmp.S
> @@ -70,4 +70,6 @@ END (memcmp)
>
>  #undef bcmp
>  weak_alias (memcmp, bcmp)
> +#undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/ia64/memcmp.S b/sysdeps/ia64/memcmp.S
> index 97539c23fd..4488e0eba4 100644
> --- a/sysdeps/ia64/memcmp.S
> +++ b/sysdeps/ia64/memcmp.S
> @@ -160,4 +160,5 @@ ENTRY(memcmp)
>  END(memcmp)
>
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/mach/hurd/i386/libc.abilist
> b/sysdeps/mach/hurd/i386/libc.abilist
> index c5da10a0cd..e849d6fa35 100644
> --- a/sysdeps/mach/hurd/i386/libc.abilist
> +++ b/sysdeps/mach/hurd/i386/libc.abilist
> @@ -2285,6 +2285,7 @@ GLIBC_2.34 res_send F
>  GLIBC_2.34 shm_open F
>  GLIBC_2.34 shm_unlink F
>  GLIBC_2.34 timespec_getres F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/powerpc/powerpc32/405/memcmp.S
> b/sysdeps/powerpc/powerpc32/405/memcmp.S
> index 6a6a54d90f..e8b1b6c9bd 100644
> --- a/sysdeps/powerpc/powerpc32/405/memcmp.S
> +++ b/sysdeps/powerpc/powerpc32/405/memcmp.S
> @@ -126,3 +126,4 @@ L(st2):
>  END (memcmp)
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp,bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc32/power4/memcmp.S
> b/sysdeps/powerpc/powerpc32/power4/memcmp.S
> index 814d2f211d..e4dde875bb 100644
> --- a/sysdeps/powerpc/powerpc32/power4/memcmp.S
> +++ b/sysdeps/powerpc/powerpc32/power4/memcmp.S
> @@ -1373,3 +1373,4 @@ END (memcmp)
>
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc32/power7/memcmp.S
> b/sysdeps/powerpc/powerpc32/power7/memcmp.S
> index 8a19953e2d..e60a62fc86 100644
> --- a/sysdeps/powerpc/powerpc32/power7/memcmp.S
> +++ b/sysdeps/powerpc/powerpc32/power7/memcmp.S
> @@ -1373,3 +1373,4 @@ END (memcmp)
>
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> b/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> index 52f244e7e7..c7fe8047ca 100644
> --- a/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> +++ b/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> @@ -177,3 +177,4 @@ L(tail8):
>  END (MEMCMP)
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc64/power4/memcmp.S
> b/sysdeps/powerpc/powerpc64/power4/memcmp.S
> index dc1be3a0d8..4ab4a90496 100644
> --- a/sysdeps/powerpc/powerpc64/power4/memcmp.S
> +++ b/sysdeps/powerpc/powerpc64/power4/memcmp.S
> @@ -1374,3 +1374,4 @@ L(duzeroLength):
>  END (MEMCMP)
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc64/power7/memcmp.S
> b/sysdeps/powerpc/powerpc64/power7/memcmp.S
> index bc034a55bc..b541978b5f 100644
> --- a/sysdeps/powerpc/powerpc64/power7/memcmp.S
> +++ b/sysdeps/powerpc/powerpc64/power7/memcmp.S
> @@ -1059,3 +1059,4 @@ L(duzeroLength):
>  END (MEMCMP)
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc64/power8/memcmp.S
> b/sysdeps/powerpc/powerpc64/power8/memcmp.S
> index b676b09a9b..d4f84a5b6f 100644
> --- a/sysdeps/powerpc/powerpc64/power8/memcmp.S
> +++ b/sysdeps/powerpc/powerpc64/power8/memcmp.S
> @@ -1442,3 +1442,4 @@ L(duzeroLength):
>  END (MEMCMP)
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/s390/memcmp-z900.S b/sysdeps/s390/memcmp-z900.S
> index 995d52e47d..0942d32814 100644
> --- a/sysdeps/s390/memcmp-z900.S
> +++ b/sysdeps/s390/memcmp-z900.S
> @@ -164,6 +164,7 @@ END(MEMCMP_Z196)
>     Otherwise see sysdeps/s390/memcmp.c.  */
>  strong_alias (MEMCMP_DEFAULT, memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
>  #endif
>
>  #if defined SHARED && IS_IN (libc)
> diff --git a/sysdeps/s390/memcmp.c b/sysdeps/s390/memcmp.c
> index 0b4e9da717..475fc45d3a 100644
> --- a/sysdeps/s390/memcmp.c
> +++ b/sysdeps/s390/memcmp.c
> @@ -46,4 +46,5 @@ s390_libc_ifunc_expr (__redirect_memcmp, memcmp,
>                       })
>                       )
>  weak_alias (memcmp, bcmp);
> +weak_alias (memcmp, __memcmpeq)
>  #endif
> diff --git a/sysdeps/sparc/sparc64/memcmp.S
> b/sysdeps/sparc/sparc64/memcmp.S
> index d8d9ff9b24..edcc19915a 100644
> --- a/sysdeps/sparc/sparc64/memcmp.S
> +++ b/sysdeps/sparc/sparc64/memcmp.S
> @@ -137,4 +137,6 @@ END(memcmp)
>
>  #undef bcmp
>  weak_alias (memcmp, bcmp)
> +#undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> index 21a2e50a88..f227ae6cee 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> @@ -2612,3 +2612,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> index a201fd69ba..0ccc3fc73e 100644
> --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> @@ -2709,6 +2709,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist
> b/sysdeps/unix/sysv/linux/arc/libc.abilist
> index 2611436937..fd80704787 100644
> --- a/sysdeps/unix/sysv/linux/arc/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
> @@ -2373,3 +2373,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> index a426241965..2ae6c58b8a 100644
> --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> @@ -491,6 +491,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> index 02f80418cc..fcfd1e8594 100644
> --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> @@ -488,6 +488,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist
> b/sysdeps/unix/sysv/linux/csky/libc.abilist
> index b7676eb372..ba034b8541 100644
> --- a/sysdeps/unix/sysv/linux/csky/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
> @@ -2647,3 +2647,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> index f6965c9d95..b7460bec8a 100644
> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> @@ -2596,6 +2596,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist
> b/sysdeps/unix/sysv/linux/i386/libc.abilist
> index 2e7603d9ed..a4dc341ded 100644
> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
> @@ -2780,6 +2780,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> index dd3a56d3fe..94b222dbc7 100644
> --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> @@ -2547,6 +2547,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> index c1e0ea9c10..12fd3b6310 100644
> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> @@ -492,6 +492,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0x98
>  GLIBC_2.4 _IO_2_1_stdin_ D 0x98
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> index 93161048ca..4d2296007a 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> @@ -2723,6 +2723,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> index 0aaeec8a27..a223278a3d 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> @@ -2696,3 +2696,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> index bec5f456c9..780a4f5b0b 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> @@ -2693,3 +2693,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> index 97d2127f78..cd65136062 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> @@ -2688,6 +2688,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> index acb0756c11..b5b9902db5 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> @@ -2686,6 +2686,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> index ebc21dde1e..57593d5f94 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> @@ -2694,6 +2694,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> index c68f7e3c6c..e944d76bed 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> @@ -2598,6 +2598,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> index e5b6834f14..8af5a3a90d 100644
> --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> @@ -2735,3 +2735,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> index 132707c8ad..3a0213b39f 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> @@ -2750,6 +2750,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> index 0af2be31a0..f57df0234b 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> @@ -2783,6 +2783,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> index cf864632d0..259a0cfc51 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> @@ -2506,6 +2506,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> index d566d675d0..126541daf1 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> @@ -2808,3 +2808,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> index c9a7eacb32..05df4d13d2 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> @@ -2375,3 +2375,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> index 8299131cb2..8e349cbff8 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> @@ -2575,3 +2575,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> index c3fe78f77f..e9de402766 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> @@ -2748,6 +2748,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> index 83e542aa8c..1a010c745d 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> @@ -2543,6 +2543,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> index dc502f6833..22ce530975 100644
> --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> @@ -2603,6 +2603,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> index cba1abb556..960df07b83 100644
> --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> @@ -2600,6 +2600,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> index d4a516fb47..eedb376f3d 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> @@ -2743,6 +2743,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> index 6268875ba3..86e0c92bef 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> @@ -2570,6 +2570,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> index 095e914b73..5e59d90623 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> @@ -2521,6 +2521,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> index dd910f7fe9..94412dc134 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> @@ -2627,3 +2627,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/x86_64/memcmp.S b/sysdeps/x86_64/memcmp.S
> index 870e15c5a0..f41ae48006 100644
> --- a/sysdeps/x86_64/memcmp.S
> +++ b/sysdeps/x86_64/memcmp.S
> @@ -358,4 +358,6 @@ END(memcmp)
>
>  #undef bcmp
>  weak_alias (memcmp, bcmp)
> +#undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/x86_64/multiarch/memcmp.c
> b/sysdeps/x86_64/multiarch/memcmp.c
> index fe725f3563..fe125e0904 100644
> --- a/sysdeps/x86_64/multiarch/memcmp.c
> +++ b/sysdeps/x86_64/multiarch/memcmp.c
> @@ -29,6 +29,8 @@
>  libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR ());
>  # undef bcmp
>  weak_alias (memcmp, bcmp)
> +# undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>
>  # ifdef SHARED
>  __hidden_ver1 (memcmp, __GI_memcmp, __redirect_memcmp)
> --
> 2.25.1
>
>
Is this good to push?
Noah Goldstein Oct. 11, 2021, 2:33 a.m. UTC | #2
On Wed, Sep 29, 2021 at 10:17 AM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> No bug.
>
> This commit adds support for __memcmpeq() as a new ABI for all
> targets. In this commit __memcmpeq() is implemented only as an alias
> to the corresponding targets memcmp() implementation. __memcmpeq() is
> added as a new symbol starting with GLIBC_2.35 and defined in string.h
> with comments explaining its behavior. Basic tests that it is callable
> and works where added in string/tester.c
>
> As discussed in the proposal "Add new ABI '__memcmpeq()' to libc"
> __memcmpeq() is essentially a reserved namespace for bcmp(). The means
> is shares the same specifications as memcmp() except the return value
> for non-equal byte sequences is any non-zero value. This is less
> strict than memcmp()'s return value specification and can be better
> optimized when a boolean return is all that is needed.
>
> __memcmpeq() is meant to only be called by compilers if they can prove
> that the return value of a memcmp() call is only used for its boolean
> value.
>
> All tests in string/tester.c passed. As well build succeeds on
> x86_64-linux-gnu target.
> ---
>  string/Versions                                  |  3 +++
>  string/memcmp.c                                  |  2 ++
>  string/string.h                                  | 16 ++++++++++++++++
>  string/tester.c                                  | 16 ++++++++++++++++
>  sysdeps/aarch64/memcmp.S                         |  2 ++
>  sysdeps/csky/abiv2/memcmp.S                      |  1 +
>  sysdeps/i386/i686/memcmp.S                       |  2 ++
>  sysdeps/i386/i686/multiarch/memcmp.c             |  1 +
>  sysdeps/i386/memcmp.S                            |  2 ++
>  sysdeps/ia64/memcmp.S                            |  1 +
>  sysdeps/mach/hurd/i386/libc.abilist              |  1 +
>  sysdeps/powerpc/powerpc32/405/memcmp.S           |  1 +
>  sysdeps/powerpc/powerpc32/power4/memcmp.S        |  1 +
>  sysdeps/powerpc/powerpc32/power7/memcmp.S        |  1 +
>  sysdeps/powerpc/powerpc64/le/power10/memcmp.S    |  1 +
>  sysdeps/powerpc/powerpc64/power4/memcmp.S        |  1 +
>  sysdeps/powerpc/powerpc64/power7/memcmp.S        |  1 +
>  sysdeps/powerpc/powerpc64/power8/memcmp.S        |  1 +
>  sysdeps/s390/memcmp-z900.S                       |  1 +
>  sysdeps/s390/memcmp.c                            |  1 +
>  sysdeps/sparc/sparc64/memcmp.S                   |  2 ++
>  sysdeps/unix/sysv/linux/aarch64/libc.abilist     |  1 +
>  sysdeps/unix/sysv/linux/alpha/libc.abilist       |  1 +
>  sysdeps/unix/sysv/linux/arc/libc.abilist         |  1 +
>  sysdeps/unix/sysv/linux/arm/be/libc.abilist      |  1 +
>  sysdeps/unix/sysv/linux/arm/le/libc.abilist      |  1 +
>  sysdeps/unix/sysv/linux/csky/libc.abilist        |  1 +
>  sysdeps/unix/sysv/linux/hppa/libc.abilist        |  1 +
>  sysdeps/unix/sysv/linux/i386/libc.abilist        |  1 +
>  sysdeps/unix/sysv/linux/ia64/libc.abilist        |  1 +
>  .../unix/sysv/linux/m68k/coldfire/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist |  1 +
>  .../unix/sysv/linux/microblaze/be/libc.abilist   |  1 +
>  .../unix/sysv/linux/microblaze/le/libc.abilist   |  1 +
>  .../unix/sysv/linux/mips/mips32/fpu/libc.abilist |  1 +
>  .../sysv/linux/mips/mips32/nofpu/libc.abilist    |  1 +
>  .../unix/sysv/linux/mips/mips64/n32/libc.abilist |  1 +
>  .../unix/sysv/linux/mips/mips64/n64/libc.abilist |  1 +
>  sysdeps/unix/sysv/linux/nios2/libc.abilist       |  1 +
>  .../linux/powerpc/powerpc32/fpu/libc.abilist     |  1 +
>  .../linux/powerpc/powerpc32/nofpu/libc.abilist   |  1 +
>  .../sysv/linux/powerpc/powerpc64/be/libc.abilist |  1 +
>  .../sysv/linux/powerpc/powerpc64/le/libc.abilist |  1 +
>  sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist  |  1 +
>  sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist  |  1 +
>  .../unix/sysv/linux/s390/s390-32/libc.abilist    |  1 +
>  .../unix/sysv/linux/s390/s390-64/libc.abilist    |  1 +
>  sysdeps/unix/sysv/linux/sh/be/libc.abilist       |  1 +
>  sysdeps/unix/sysv/linux/sh/le/libc.abilist       |  1 +
>  .../unix/sysv/linux/sparc/sparc32/libc.abilist   |  1 +
>  .../unix/sysv/linux/sparc/sparc64/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/x86_64/64/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist  |  1 +
>  sysdeps/x86_64/memcmp.S                          |  2 ++
>  sysdeps/x86_64/multiarch/memcmp.c                |  2 ++
>  55 files changed, 94 insertions(+)
>
> diff --git a/string/Versions b/string/Versions
> index 298ecd401a..864c4cf7a4 100644
> --- a/string/Versions
> +++ b/string/Versions
> @@ -89,4 +89,7 @@ libc {
>      sigdescr_np; sigabbrev_np;
>      strerrordesc_np; strerrorname_np;
>    }
> +  GLIBC_2.35 {
> +    __memcmpeq;
> +  }
>  }
> diff --git a/string/memcmp.c b/string/memcmp.c
> index 9b46d7a905..5020be00e0 100644
> --- a/string/memcmp.c
> +++ b/string/memcmp.c
> @@ -358,4 +358,6 @@ libc_hidden_builtin_def(memcmp)
>  #ifdef weak_alias
>  # undef bcmp
>  weak_alias (memcmp, bcmp)
> +# undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  #endif
> diff --git a/string/string.h b/string/string.h
> index 04e1b7067d..d0b714f836 100644
> --- a/string/string.h
> +++ b/string/string.h
> @@ -64,6 +64,22 @@ extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
>  extern int memcmp (const void *__s1, const void *__s2, size_t __n)
>       __THROW __attribute_pure__ __nonnull ((1, 2));
>
> +/* Compare N bytes of S1 and S2.  Return zero if S1 and S2 are equal.
> +   Return some non-zero value otherwise.
> +
> +   Essentially __memcmpeq has the exact same semantics as memcmp
> +   except the return value is less constrained.  memcmp is always a
> +   correct implementation of __memcmpeq.  As well !!memcmp, -memcmp,
> +   or bcmp are correct implementations.
> +
> +   __memcmpeq is meant to be used by compilers when memcmp return is
> +   only used for its bolean value.
> +
> +   __memcmpeq is declared only for use by compilers.  Programs should
> +   continue to use memcmp.  */
> +extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n)
> +     __THROW __attribute_pure__ __nonnull ((1, 2));
> +
>  /* Search N bytes of S for C.  */
>  #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
>  extern "C++"
> diff --git a/string/tester.c b/string/tester.c
> index 778160ae6e..605b3f00f9 100644
> --- a/string/tester.c
> +++ b/string/tester.c
> @@ -1449,6 +1449,19 @@ test_bcmp (void)
>    check(bcmp("abc", "def", 0) == 0, 8);        /* Zero count. */
>  }
>
> +static void
> +test_memcmpeq (void)
> +{
> +  it = "__memcmpeq";
> +  check (__memcmpeq ("a", "a", 1) == 0, 1); /* Identity.  */
> +  check (__memcmpeq ("abc", "abc", 3) == 0, 2); /* Multicharacter.  */
> +  check (__memcmpeq ("abcd", "abce", 4) != 0, 3); /* Honestly unequal.  */
> +  check (__memcmpeq ("abce", "abcd", 4) != 0, 4);
> +  check (__memcmpeq ("alph", "beta", 4) != 0, 5);
> +  check (__memcmpeq ("abce", "abcd", 3) == 0, 6); /* Count limited.  */
> +  check (__memcmpeq ("abc", "def", 0) == 0, 8); /* Zero count.  */
> +}
> +
>  static void
>  test_strerror (void)
>  {
> @@ -1611,6 +1624,9 @@ main (void)
>    /* bcmp - somewhat like memcmp.  */
>    test_bcmp ();
>
> +  /* __memcmpeq - somewhat like memcmp.  */
> +  test_memcmpeq ();
> +
>    /* strndup.  */
>    test_strndup ();
>
> diff --git a/sysdeps/aarch64/memcmp.S b/sysdeps/aarch64/memcmp.S
> index c1937f6f5c..bc932eff2a 100644
> --- a/sysdeps/aarch64/memcmp.S
> +++ b/sysdeps/aarch64/memcmp.S
> @@ -177,4 +177,6 @@ L(ret_0):
>  END (memcmp)
>  #undef bcmp
>  weak_alias (memcmp, bcmp)
> +#undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/csky/abiv2/memcmp.S b/sysdeps/csky/abiv2/memcmp.S
> index 1560387618..d61fca0f29 100644
> --- a/sysdeps/csky/abiv2/memcmp.S
> +++ b/sysdeps/csky/abiv2/memcmp.S
> @@ -138,5 +138,6 @@ ENTRY (memcmp)
>         br      .L_s1_aligned
>  END (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_def (memcmp)
>  .weak memcmp
> diff --git a/sysdeps/i386/i686/memcmp.S b/sysdeps/i386/i686/memcmp.S
> index b26b124fad..0194f8deab 100644
> --- a/sysdeps/i386/i686/memcmp.S
> +++ b/sysdeps/i386/i686/memcmp.S
> @@ -405,4 +405,6 @@ L(table_32bytes) :
>
>  #undef bcmp
>  weak_alias (memcmp, bcmp)
> +#undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/i386/i686/multiarch/memcmp.c b/sysdeps/i386/i686/multiarch/memcmp.c
> index 6e058a8857..956fc8e601 100644
> --- a/sysdeps/i386/i686/multiarch/memcmp.c
> +++ b/sysdeps/i386/i686/multiarch/memcmp.c
> @@ -29,4 +29,5 @@
>  libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR ());
>
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
>  #endif
> diff --git a/sysdeps/i386/memcmp.S b/sysdeps/i386/memcmp.S
> index 1f212b0f6d..18e225f963 100644
> --- a/sysdeps/i386/memcmp.S
> +++ b/sysdeps/i386/memcmp.S
> @@ -70,4 +70,6 @@ END (memcmp)
>
>  #undef bcmp
>  weak_alias (memcmp, bcmp)
> +#undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/ia64/memcmp.S b/sysdeps/ia64/memcmp.S
> index 97539c23fd..4488e0eba4 100644
> --- a/sysdeps/ia64/memcmp.S
> +++ b/sysdeps/ia64/memcmp.S
> @@ -160,4 +160,5 @@ ENTRY(memcmp)
>  END(memcmp)
>
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
> index c5da10a0cd..e849d6fa35 100644
> --- a/sysdeps/mach/hurd/i386/libc.abilist
> +++ b/sysdeps/mach/hurd/i386/libc.abilist
> @@ -2285,6 +2285,7 @@ GLIBC_2.34 res_send F
>  GLIBC_2.34 shm_open F
>  GLIBC_2.34 shm_unlink F
>  GLIBC_2.34 timespec_getres F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/powerpc/powerpc32/405/memcmp.S b/sysdeps/powerpc/powerpc32/405/memcmp.S
> index 6a6a54d90f..e8b1b6c9bd 100644
> --- a/sysdeps/powerpc/powerpc32/405/memcmp.S
> +++ b/sysdeps/powerpc/powerpc32/405/memcmp.S
> @@ -126,3 +126,4 @@ L(st2):
>  END (memcmp)
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp,bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc32/power4/memcmp.S b/sysdeps/powerpc/powerpc32/power4/memcmp.S
> index 814d2f211d..e4dde875bb 100644
> --- a/sysdeps/powerpc/powerpc32/power4/memcmp.S
> +++ b/sysdeps/powerpc/powerpc32/power4/memcmp.S
> @@ -1373,3 +1373,4 @@ END (memcmp)
>
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc32/power7/memcmp.S b/sysdeps/powerpc/powerpc32/power7/memcmp.S
> index 8a19953e2d..e60a62fc86 100644
> --- a/sysdeps/powerpc/powerpc32/power7/memcmp.S
> +++ b/sysdeps/powerpc/powerpc32/power7/memcmp.S
> @@ -1373,3 +1373,4 @@ END (memcmp)
>
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc64/le/power10/memcmp.S b/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> index 52f244e7e7..c7fe8047ca 100644
> --- a/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> +++ b/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> @@ -177,3 +177,4 @@ L(tail8):
>  END (MEMCMP)
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc64/power4/memcmp.S b/sysdeps/powerpc/powerpc64/power4/memcmp.S
> index dc1be3a0d8..4ab4a90496 100644
> --- a/sysdeps/powerpc/powerpc64/power4/memcmp.S
> +++ b/sysdeps/powerpc/powerpc64/power4/memcmp.S
> @@ -1374,3 +1374,4 @@ L(duzeroLength):
>  END (MEMCMP)
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc64/power7/memcmp.S b/sysdeps/powerpc/powerpc64/power7/memcmp.S
> index bc034a55bc..b541978b5f 100644
> --- a/sysdeps/powerpc/powerpc64/power7/memcmp.S
> +++ b/sysdeps/powerpc/powerpc64/power7/memcmp.S
> @@ -1059,3 +1059,4 @@ L(duzeroLength):
>  END (MEMCMP)
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc64/power8/memcmp.S b/sysdeps/powerpc/powerpc64/power8/memcmp.S
> index b676b09a9b..d4f84a5b6f 100644
> --- a/sysdeps/powerpc/powerpc64/power8/memcmp.S
> +++ b/sysdeps/powerpc/powerpc64/power8/memcmp.S
> @@ -1442,3 +1442,4 @@ L(duzeroLength):
>  END (MEMCMP)
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/s390/memcmp-z900.S b/sysdeps/s390/memcmp-z900.S
> index 995d52e47d..0942d32814 100644
> --- a/sysdeps/s390/memcmp-z900.S
> +++ b/sysdeps/s390/memcmp-z900.S
> @@ -164,6 +164,7 @@ END(MEMCMP_Z196)
>     Otherwise see sysdeps/s390/memcmp.c.  */
>  strong_alias (MEMCMP_DEFAULT, memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
>  #endif
>
>  #if defined SHARED && IS_IN (libc)
> diff --git a/sysdeps/s390/memcmp.c b/sysdeps/s390/memcmp.c
> index 0b4e9da717..475fc45d3a 100644
> --- a/sysdeps/s390/memcmp.c
> +++ b/sysdeps/s390/memcmp.c
> @@ -46,4 +46,5 @@ s390_libc_ifunc_expr (__redirect_memcmp, memcmp,
>                       })
>                       )
>  weak_alias (memcmp, bcmp);
> +weak_alias (memcmp, __memcmpeq)
>  #endif
> diff --git a/sysdeps/sparc/sparc64/memcmp.S b/sysdeps/sparc/sparc64/memcmp.S
> index d8d9ff9b24..edcc19915a 100644
> --- a/sysdeps/sparc/sparc64/memcmp.S
> +++ b/sysdeps/sparc/sparc64/memcmp.S
> @@ -137,4 +137,6 @@ END(memcmp)
>
>  #undef bcmp
>  weak_alias (memcmp, bcmp)
> +#undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> index 21a2e50a88..f227ae6cee 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> @@ -2612,3 +2612,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> index a201fd69ba..0ccc3fc73e 100644
> --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> @@ -2709,6 +2709,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
> index 2611436937..fd80704787 100644
> --- a/sysdeps/unix/sysv/linux/arc/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
> @@ -2373,3 +2373,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> index a426241965..2ae6c58b8a 100644
> --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> @@ -491,6 +491,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> index 02f80418cc..fcfd1e8594 100644
> --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> @@ -488,6 +488,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
> index b7676eb372..ba034b8541 100644
> --- a/sysdeps/unix/sysv/linux/csky/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
> @@ -2647,3 +2647,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> index f6965c9d95..b7460bec8a 100644
> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> @@ -2596,6 +2596,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
> index 2e7603d9ed..a4dc341ded 100644
> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
> @@ -2780,6 +2780,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> index dd3a56d3fe..94b222dbc7 100644
> --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> @@ -2547,6 +2547,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> index c1e0ea9c10..12fd3b6310 100644
> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> @@ -492,6 +492,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0x98
>  GLIBC_2.4 _IO_2_1_stdin_ D 0x98
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> index 93161048ca..4d2296007a 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> @@ -2723,6 +2723,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> index 0aaeec8a27..a223278a3d 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> @@ -2696,3 +2696,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> index bec5f456c9..780a4f5b0b 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> @@ -2693,3 +2693,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> index 97d2127f78..cd65136062 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> @@ -2688,6 +2688,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> index acb0756c11..b5b9902db5 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> @@ -2686,6 +2686,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> index ebc21dde1e..57593d5f94 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> @@ -2694,6 +2694,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> index c68f7e3c6c..e944d76bed 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> @@ -2598,6 +2598,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> index e5b6834f14..8af5a3a90d 100644
> --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> @@ -2735,3 +2735,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> index 132707c8ad..3a0213b39f 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> @@ -2750,6 +2750,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> index 0af2be31a0..f57df0234b 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> @@ -2783,6 +2783,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> index cf864632d0..259a0cfc51 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> @@ -2506,6 +2506,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> index d566d675d0..126541daf1 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> @@ -2808,3 +2808,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> index c9a7eacb32..05df4d13d2 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> @@ -2375,3 +2375,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> index 8299131cb2..8e349cbff8 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> @@ -2575,3 +2575,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> index c3fe78f77f..e9de402766 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> @@ -2748,6 +2748,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> index 83e542aa8c..1a010c745d 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> @@ -2543,6 +2543,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> index dc502f6833..22ce530975 100644
> --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> @@ -2603,6 +2603,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> index cba1abb556..960df07b83 100644
> --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> @@ -2600,6 +2600,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> index d4a516fb47..eedb376f3d 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> @@ -2743,6 +2743,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> index 6268875ba3..86e0c92bef 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> @@ -2570,6 +2570,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> index 095e914b73..5e59d90623 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> @@ -2521,6 +2521,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> index dd910f7fe9..94412dc134 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> @@ -2627,3 +2627,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/x86_64/memcmp.S b/sysdeps/x86_64/memcmp.S
> index 870e15c5a0..f41ae48006 100644
> --- a/sysdeps/x86_64/memcmp.S
> +++ b/sysdeps/x86_64/memcmp.S
> @@ -358,4 +358,6 @@ END(memcmp)
>
>  #undef bcmp
>  weak_alias (memcmp, bcmp)
> +#undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/x86_64/multiarch/memcmp.c b/sysdeps/x86_64/multiarch/memcmp.c
> index fe725f3563..fe125e0904 100644
> --- a/sysdeps/x86_64/multiarch/memcmp.c
> +++ b/sysdeps/x86_64/multiarch/memcmp.c
> @@ -29,6 +29,8 @@
>  libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR ());
>  # undef bcmp
>  weak_alias (memcmp, bcmp)
> +# undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>
>  # ifdef SHARED
>  __hidden_ver1 (memcmp, __GI_memcmp, __redirect_memcmp)
> --
> 2.25.1
>

Ping.
Noah Goldstein Oct. 18, 2021, 2:47 p.m. UTC | #3
On Sun, Oct 10, 2021 at 10:33 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> On Wed, Sep 29, 2021 at 10:17 AM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> >
> > No bug.
> >
> > This commit adds support for __memcmpeq() as a new ABI for all
> > targets. In this commit __memcmpeq() is implemented only as an alias
> > to the corresponding targets memcmp() implementation. __memcmpeq() is
> > added as a new symbol starting with GLIBC_2.35 and defined in string.h
> > with comments explaining its behavior. Basic tests that it is callable
> > and works where added in string/tester.c
> >
> > As discussed in the proposal "Add new ABI '__memcmpeq()' to libc"
> > __memcmpeq() is essentially a reserved namespace for bcmp(). The means
> > is shares the same specifications as memcmp() except the return value
> > for non-equal byte sequences is any non-zero value. This is less
> > strict than memcmp()'s return value specification and can be better
> > optimized when a boolean return is all that is needed.
> >
> > __memcmpeq() is meant to only be called by compilers if they can prove
> > that the return value of a memcmp() call is only used for its boolean
> > value.
> >
> > All tests in string/tester.c passed. As well build succeeds on
> > x86_64-linux-gnu target.
> > ---
> >  string/Versions                                  |  3 +++
> >  string/memcmp.c                                  |  2 ++
> >  string/string.h                                  | 16 ++++++++++++++++
> >  string/tester.c                                  | 16 ++++++++++++++++
> >  sysdeps/aarch64/memcmp.S                         |  2 ++
> >  sysdeps/csky/abiv2/memcmp.S                      |  1 +
> >  sysdeps/i386/i686/memcmp.S                       |  2 ++
> >  sysdeps/i386/i686/multiarch/memcmp.c             |  1 +
> >  sysdeps/i386/memcmp.S                            |  2 ++
> >  sysdeps/ia64/memcmp.S                            |  1 +
> >  sysdeps/mach/hurd/i386/libc.abilist              |  1 +
> >  sysdeps/powerpc/powerpc32/405/memcmp.S           |  1 +
> >  sysdeps/powerpc/powerpc32/power4/memcmp.S        |  1 +
> >  sysdeps/powerpc/powerpc32/power7/memcmp.S        |  1 +
> >  sysdeps/powerpc/powerpc64/le/power10/memcmp.S    |  1 +
> >  sysdeps/powerpc/powerpc64/power4/memcmp.S        |  1 +
> >  sysdeps/powerpc/powerpc64/power7/memcmp.S        |  1 +
> >  sysdeps/powerpc/powerpc64/power8/memcmp.S        |  1 +
> >  sysdeps/s390/memcmp-z900.S                       |  1 +
> >  sysdeps/s390/memcmp.c                            |  1 +
> >  sysdeps/sparc/sparc64/memcmp.S                   |  2 ++
> >  sysdeps/unix/sysv/linux/aarch64/libc.abilist     |  1 +
> >  sysdeps/unix/sysv/linux/alpha/libc.abilist       |  1 +
> >  sysdeps/unix/sysv/linux/arc/libc.abilist         |  1 +
> >  sysdeps/unix/sysv/linux/arm/be/libc.abilist      |  1 +
> >  sysdeps/unix/sysv/linux/arm/le/libc.abilist      |  1 +
> >  sysdeps/unix/sysv/linux/csky/libc.abilist        |  1 +
> >  sysdeps/unix/sysv/linux/hppa/libc.abilist        |  1 +
> >  sysdeps/unix/sysv/linux/i386/libc.abilist        |  1 +
> >  sysdeps/unix/sysv/linux/ia64/libc.abilist        |  1 +
> >  .../unix/sysv/linux/m68k/coldfire/libc.abilist   |  1 +
> >  sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist |  1 +
> >  .../unix/sysv/linux/microblaze/be/libc.abilist   |  1 +
> >  .../unix/sysv/linux/microblaze/le/libc.abilist   |  1 +
> >  .../unix/sysv/linux/mips/mips32/fpu/libc.abilist |  1 +
> >  .../sysv/linux/mips/mips32/nofpu/libc.abilist    |  1 +
> >  .../unix/sysv/linux/mips/mips64/n32/libc.abilist |  1 +
> >  .../unix/sysv/linux/mips/mips64/n64/libc.abilist |  1 +
> >  sysdeps/unix/sysv/linux/nios2/libc.abilist       |  1 +
> >  .../linux/powerpc/powerpc32/fpu/libc.abilist     |  1 +
> >  .../linux/powerpc/powerpc32/nofpu/libc.abilist   |  1 +
> >  .../sysv/linux/powerpc/powerpc64/be/libc.abilist |  1 +
> >  .../sysv/linux/powerpc/powerpc64/le/libc.abilist |  1 +
> >  sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist  |  1 +
> >  sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist  |  1 +
> >  .../unix/sysv/linux/s390/s390-32/libc.abilist    |  1 +
> >  .../unix/sysv/linux/s390/s390-64/libc.abilist    |  1 +
> >  sysdeps/unix/sysv/linux/sh/be/libc.abilist       |  1 +
> >  sysdeps/unix/sysv/linux/sh/le/libc.abilist       |  1 +
> >  .../unix/sysv/linux/sparc/sparc32/libc.abilist   |  1 +
> >  .../unix/sysv/linux/sparc/sparc64/libc.abilist   |  1 +
> >  sysdeps/unix/sysv/linux/x86_64/64/libc.abilist   |  1 +
> >  sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist  |  1 +
> >  sysdeps/x86_64/memcmp.S                          |  2 ++
> >  sysdeps/x86_64/multiarch/memcmp.c                |  2 ++
> >  55 files changed, 94 insertions(+)
> >
> > diff --git a/string/Versions b/string/Versions
> > index 298ecd401a..864c4cf7a4 100644
> > --- a/string/Versions
> > +++ b/string/Versions
> > @@ -89,4 +89,7 @@ libc {
> >      sigdescr_np; sigabbrev_np;
> >      strerrordesc_np; strerrorname_np;
> >    }
> > +  GLIBC_2.35 {
> > +    __memcmpeq;
> > +  }
> >  }
> > diff --git a/string/memcmp.c b/string/memcmp.c
> > index 9b46d7a905..5020be00e0 100644
> > --- a/string/memcmp.c
> > +++ b/string/memcmp.c
> > @@ -358,4 +358,6 @@ libc_hidden_builtin_def(memcmp)
> >  #ifdef weak_alias
> >  # undef bcmp
> >  weak_alias (memcmp, bcmp)
> > +# undef __memcmpeq
> > +weak_alias (memcmp, __memcmpeq)
> >  #endif
> > diff --git a/string/string.h b/string/string.h
> > index 04e1b7067d..d0b714f836 100644
> > --- a/string/string.h
> > +++ b/string/string.h
> > @@ -64,6 +64,22 @@ extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
> >  extern int memcmp (const void *__s1, const void *__s2, size_t __n)
> >       __THROW __attribute_pure__ __nonnull ((1, 2));
> >
> > +/* Compare N bytes of S1 and S2.  Return zero if S1 and S2 are equal.
> > +   Return some non-zero value otherwise.
> > +
> > +   Essentially __memcmpeq has the exact same semantics as memcmp
> > +   except the return value is less constrained.  memcmp is always a
> > +   correct implementation of __memcmpeq.  As well !!memcmp, -memcmp,
> > +   or bcmp are correct implementations.
> > +
> > +   __memcmpeq is meant to be used by compilers when memcmp return is
> > +   only used for its bolean value.
> > +
> > +   __memcmpeq is declared only for use by compilers.  Programs should
> > +   continue to use memcmp.  */
> > +extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n)
> > +     __THROW __attribute_pure__ __nonnull ((1, 2));
> > +
> >  /* Search N bytes of S for C.  */
> >  #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
> >  extern "C++"
> > diff --git a/string/tester.c b/string/tester.c
> > index 778160ae6e..605b3f00f9 100644
> > --- a/string/tester.c
> > +++ b/string/tester.c
> > @@ -1449,6 +1449,19 @@ test_bcmp (void)
> >    check(bcmp("abc", "def", 0) == 0, 8);        /* Zero count. */
> >  }
> >
> > +static void
> > +test_memcmpeq (void)
> > +{
> > +  it = "__memcmpeq";
> > +  check (__memcmpeq ("a", "a", 1) == 0, 1); /* Identity.  */
> > +  check (__memcmpeq ("abc", "abc", 3) == 0, 2); /* Multicharacter.  */
> > +  check (__memcmpeq ("abcd", "abce", 4) != 0, 3); /* Honestly unequal.  */
> > +  check (__memcmpeq ("abce", "abcd", 4) != 0, 4);
> > +  check (__memcmpeq ("alph", "beta", 4) != 0, 5);
> > +  check (__memcmpeq ("abce", "abcd", 3) == 0, 6); /* Count limited.  */
> > +  check (__memcmpeq ("abc", "def", 0) == 0, 8); /* Zero count.  */
> > +}
> > +
> >  static void
> >  test_strerror (void)
> >  {
> > @@ -1611,6 +1624,9 @@ main (void)
> >    /* bcmp - somewhat like memcmp.  */
> >    test_bcmp ();
> >
> > +  /* __memcmpeq - somewhat like memcmp.  */
> > +  test_memcmpeq ();
> > +
> >    /* strndup.  */
> >    test_strndup ();
> >
> > diff --git a/sysdeps/aarch64/memcmp.S b/sysdeps/aarch64/memcmp.S
> > index c1937f6f5c..bc932eff2a 100644
> > --- a/sysdeps/aarch64/memcmp.S
> > +++ b/sysdeps/aarch64/memcmp.S
> > @@ -177,4 +177,6 @@ L(ret_0):
> >  END (memcmp)
> >  #undef bcmp
> >  weak_alias (memcmp, bcmp)
> > +#undef __memcmpeq
> > +weak_alias (memcmp, __memcmpeq)
> >  libc_hidden_builtin_def (memcmp)
> > diff --git a/sysdeps/csky/abiv2/memcmp.S b/sysdeps/csky/abiv2/memcmp.S
> > index 1560387618..d61fca0f29 100644
> > --- a/sysdeps/csky/abiv2/memcmp.S
> > +++ b/sysdeps/csky/abiv2/memcmp.S
> > @@ -138,5 +138,6 @@ ENTRY (memcmp)
> >         br      .L_s1_aligned
> >  END (memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> >  libc_hidden_def (memcmp)
> >  .weak memcmp
> > diff --git a/sysdeps/i386/i686/memcmp.S b/sysdeps/i386/i686/memcmp.S
> > index b26b124fad..0194f8deab 100644
> > --- a/sysdeps/i386/i686/memcmp.S
> > +++ b/sysdeps/i386/i686/memcmp.S
> > @@ -405,4 +405,6 @@ L(table_32bytes) :
> >
> >  #undef bcmp
> >  weak_alias (memcmp, bcmp)
> > +#undef __memcmpeq
> > +weak_alias (memcmp, __memcmpeq)
> >  libc_hidden_builtin_def (memcmp)
> > diff --git a/sysdeps/i386/i686/multiarch/memcmp.c b/sysdeps/i386/i686/multiarch/memcmp.c
> > index 6e058a8857..956fc8e601 100644
> > --- a/sysdeps/i386/i686/multiarch/memcmp.c
> > +++ b/sysdeps/i386/i686/multiarch/memcmp.c
> > @@ -29,4 +29,5 @@
> >  libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR ());
> >
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> >  #endif
> > diff --git a/sysdeps/i386/memcmp.S b/sysdeps/i386/memcmp.S
> > index 1f212b0f6d..18e225f963 100644
> > --- a/sysdeps/i386/memcmp.S
> > +++ b/sysdeps/i386/memcmp.S
> > @@ -70,4 +70,6 @@ END (memcmp)
> >
> >  #undef bcmp
> >  weak_alias (memcmp, bcmp)
> > +#undef __memcmpeq
> > +weak_alias (memcmp, __memcmpeq)
> >  libc_hidden_builtin_def (memcmp)
> > diff --git a/sysdeps/ia64/memcmp.S b/sysdeps/ia64/memcmp.S
> > index 97539c23fd..4488e0eba4 100644
> > --- a/sysdeps/ia64/memcmp.S
> > +++ b/sysdeps/ia64/memcmp.S
> > @@ -160,4 +160,5 @@ ENTRY(memcmp)
> >  END(memcmp)
> >
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> >  libc_hidden_builtin_def (memcmp)
> > diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
> > index c5da10a0cd..e849d6fa35 100644
> > --- a/sysdeps/mach/hurd/i386/libc.abilist
> > +++ b/sysdeps/mach/hurd/i386/libc.abilist
> > @@ -2285,6 +2285,7 @@ GLIBC_2.34 res_send F
> >  GLIBC_2.34 shm_open F
> >  GLIBC_2.34 shm_unlink F
> >  GLIBC_2.34 timespec_getres F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/powerpc/powerpc32/405/memcmp.S b/sysdeps/powerpc/powerpc32/405/memcmp.S
> > index 6a6a54d90f..e8b1b6c9bd 100644
> > --- a/sysdeps/powerpc/powerpc32/405/memcmp.S
> > +++ b/sysdeps/powerpc/powerpc32/405/memcmp.S
> > @@ -126,3 +126,4 @@ L(st2):
> >  END (memcmp)
> >  libc_hidden_builtin_def (memcmp)
> >  weak_alias (memcmp,bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> > diff --git a/sysdeps/powerpc/powerpc32/power4/memcmp.S b/sysdeps/powerpc/powerpc32/power4/memcmp.S
> > index 814d2f211d..e4dde875bb 100644
> > --- a/sysdeps/powerpc/powerpc32/power4/memcmp.S
> > +++ b/sysdeps/powerpc/powerpc32/power4/memcmp.S
> > @@ -1373,3 +1373,4 @@ END (memcmp)
> >
> >  libc_hidden_builtin_def (memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> > diff --git a/sysdeps/powerpc/powerpc32/power7/memcmp.S b/sysdeps/powerpc/powerpc32/power7/memcmp.S
> > index 8a19953e2d..e60a62fc86 100644
> > --- a/sysdeps/powerpc/powerpc32/power7/memcmp.S
> > +++ b/sysdeps/powerpc/powerpc32/power7/memcmp.S
> > @@ -1373,3 +1373,4 @@ END (memcmp)
> >
> >  libc_hidden_builtin_def (memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> > diff --git a/sysdeps/powerpc/powerpc64/le/power10/memcmp.S b/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> > index 52f244e7e7..c7fe8047ca 100644
> > --- a/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> > +++ b/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> > @@ -177,3 +177,4 @@ L(tail8):
> >  END (MEMCMP)
> >  libc_hidden_builtin_def (memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> > diff --git a/sysdeps/powerpc/powerpc64/power4/memcmp.S b/sysdeps/powerpc/powerpc64/power4/memcmp.S
> > index dc1be3a0d8..4ab4a90496 100644
> > --- a/sysdeps/powerpc/powerpc64/power4/memcmp.S
> > +++ b/sysdeps/powerpc/powerpc64/power4/memcmp.S
> > @@ -1374,3 +1374,4 @@ L(duzeroLength):
> >  END (MEMCMP)
> >  libc_hidden_builtin_def (memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> > diff --git a/sysdeps/powerpc/powerpc64/power7/memcmp.S b/sysdeps/powerpc/powerpc64/power7/memcmp.S
> > index bc034a55bc..b541978b5f 100644
> > --- a/sysdeps/powerpc/powerpc64/power7/memcmp.S
> > +++ b/sysdeps/powerpc/powerpc64/power7/memcmp.S
> > @@ -1059,3 +1059,4 @@ L(duzeroLength):
> >  END (MEMCMP)
> >  libc_hidden_builtin_def (memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> > diff --git a/sysdeps/powerpc/powerpc64/power8/memcmp.S b/sysdeps/powerpc/powerpc64/power8/memcmp.S
> > index b676b09a9b..d4f84a5b6f 100644
> > --- a/sysdeps/powerpc/powerpc64/power8/memcmp.S
> > +++ b/sysdeps/powerpc/powerpc64/power8/memcmp.S
> > @@ -1442,3 +1442,4 @@ L(duzeroLength):
> >  END (MEMCMP)
> >  libc_hidden_builtin_def (memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> > diff --git a/sysdeps/s390/memcmp-z900.S b/sysdeps/s390/memcmp-z900.S
> > index 995d52e47d..0942d32814 100644
> > --- a/sysdeps/s390/memcmp-z900.S
> > +++ b/sysdeps/s390/memcmp-z900.S
> > @@ -164,6 +164,7 @@ END(MEMCMP_Z196)
> >     Otherwise see sysdeps/s390/memcmp.c.  */
> >  strong_alias (MEMCMP_DEFAULT, memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> >  #endif
> >
> >  #if defined SHARED && IS_IN (libc)
> > diff --git a/sysdeps/s390/memcmp.c b/sysdeps/s390/memcmp.c
> > index 0b4e9da717..475fc45d3a 100644
> > --- a/sysdeps/s390/memcmp.c
> > +++ b/sysdeps/s390/memcmp.c
> > @@ -46,4 +46,5 @@ s390_libc_ifunc_expr (__redirect_memcmp, memcmp,
> >                       })
> >                       )
> >  weak_alias (memcmp, bcmp);
> > +weak_alias (memcmp, __memcmpeq)
> >  #endif
> > diff --git a/sysdeps/sparc/sparc64/memcmp.S b/sysdeps/sparc/sparc64/memcmp.S
> > index d8d9ff9b24..edcc19915a 100644
> > --- a/sysdeps/sparc/sparc64/memcmp.S
> > +++ b/sysdeps/sparc/sparc64/memcmp.S
> > @@ -137,4 +137,6 @@ END(memcmp)
> >
> >  #undef bcmp
> >  weak_alias (memcmp, bcmp)
> > +#undef __memcmpeq
> > +weak_alias (memcmp, __memcmpeq)
> >  libc_hidden_builtin_def (memcmp)
> > diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> > index 21a2e50a88..f227ae6cee 100644
> > --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> > @@ -2612,3 +2612,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> > index a201fd69ba..0ccc3fc73e 100644
> > --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> > @@ -2709,6 +2709,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _IO_fprintf F
> >  GLIBC_2.4 _IO_printf F
> >  GLIBC_2.4 _IO_sprintf F
> > diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
> > index 2611436937..fd80704787 100644
> > --- a/sysdeps/unix/sysv/linux/arc/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
> > @@ -2373,3 +2373,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> > index a426241965..2ae6c58b8a 100644
> > --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> > @@ -491,6 +491,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _Exit F
> >  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
> >  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> > diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> > index 02f80418cc..fcfd1e8594 100644
> > --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> > @@ -488,6 +488,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _Exit F
> >  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
> >  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> > diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
> > index b7676eb372..ba034b8541 100644
> > --- a/sysdeps/unix/sysv/linux/csky/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
> > @@ -2647,3 +2647,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> > index f6965c9d95..b7460bec8a 100644
> > --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> > @@ -2596,6 +2596,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
> > index 2e7603d9ed..a4dc341ded 100644
> > --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
> > @@ -2780,6 +2780,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> > index dd3a56d3fe..94b222dbc7 100644
> > --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> > @@ -2547,6 +2547,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> > index c1e0ea9c10..12fd3b6310 100644
> > --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> > @@ -492,6 +492,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _Exit F
> >  GLIBC_2.4 _IO_2_1_stderr_ D 0x98
> >  GLIBC_2.4 _IO_2_1_stdin_ D 0x98
> > diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> > index 93161048ca..4d2296007a 100644
> > --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> > @@ -2723,6 +2723,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> > index 0aaeec8a27..a223278a3d 100644
> > --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> > @@ -2696,3 +2696,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> > index bec5f456c9..780a4f5b0b 100644
> > --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> > @@ -2693,3 +2693,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> > index 97d2127f78..cd65136062 100644
> > --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> > @@ -2688,6 +2688,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> > index acb0756c11..b5b9902db5 100644
> > --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> > @@ -2686,6 +2686,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> > index ebc21dde1e..57593d5f94 100644
> > --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> > @@ -2694,6 +2694,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> > index c68f7e3c6c..e944d76bed 100644
> > --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> > @@ -2598,6 +2598,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> > index e5b6834f14..8af5a3a90d 100644
> > --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> > @@ -2735,3 +2735,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> > index 132707c8ad..3a0213b39f 100644
> > --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> > @@ -2750,6 +2750,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _IO_fprintf F
> >  GLIBC_2.4 _IO_printf F
> >  GLIBC_2.4 _IO_sprintf F
> > diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> > index 0af2be31a0..f57df0234b 100644
> > --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> > @@ -2783,6 +2783,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _IO_fprintf F
> >  GLIBC_2.4 _IO_printf F
> >  GLIBC_2.4 _IO_sprintf F
> > diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> > index cf864632d0..259a0cfc51 100644
> > --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> > @@ -2506,6 +2506,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _IO_fprintf F
> >  GLIBC_2.4 _IO_printf F
> >  GLIBC_2.4 _IO_sprintf F
> > diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> > index d566d675d0..126541daf1 100644
> > --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> > @@ -2808,3 +2808,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> > index c9a7eacb32..05df4d13d2 100644
> > --- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> > @@ -2375,3 +2375,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> > index 8299131cb2..8e349cbff8 100644
> > --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> > @@ -2575,3 +2575,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> > index c3fe78f77f..e9de402766 100644
> > --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> > @@ -2748,6 +2748,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _IO_fprintf F
> >  GLIBC_2.4 _IO_printf F
> >  GLIBC_2.4 _IO_sprintf F
> > diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> > index 83e542aa8c..1a010c745d 100644
> > --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> > @@ -2543,6 +2543,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _IO_fprintf F
> >  GLIBC_2.4 _IO_printf F
> >  GLIBC_2.4 _IO_sprintf F
> > diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> > index dc502f6833..22ce530975 100644
> > --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> > @@ -2603,6 +2603,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> > index cba1abb556..960df07b83 100644
> > --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> > @@ -2600,6 +2600,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> > index d4a516fb47..eedb376f3d 100644
> > --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> > @@ -2743,6 +2743,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _IO_fprintf F
> >  GLIBC_2.4 _IO_printf F
> >  GLIBC_2.4 _IO_sprintf F
> > diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> > index 6268875ba3..86e0c92bef 100644
> > --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> > @@ -2570,6 +2570,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> > index 095e914b73..5e59d90623 100644
> > --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> > @@ -2521,6 +2521,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> > index dd910f7fe9..94412dc134 100644
> > --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> > @@ -2627,3 +2627,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/x86_64/memcmp.S b/sysdeps/x86_64/memcmp.S
> > index 870e15c5a0..f41ae48006 100644
> > --- a/sysdeps/x86_64/memcmp.S
> > +++ b/sysdeps/x86_64/memcmp.S
> > @@ -358,4 +358,6 @@ END(memcmp)
> >
> >  #undef bcmp
> >  weak_alias (memcmp, bcmp)
> > +#undef __memcmpeq
> > +weak_alias (memcmp, __memcmpeq)
> >  libc_hidden_builtin_def (memcmp)
> > diff --git a/sysdeps/x86_64/multiarch/memcmp.c b/sysdeps/x86_64/multiarch/memcmp.c
> > index fe725f3563..fe125e0904 100644
> > --- a/sysdeps/x86_64/multiarch/memcmp.c
> > +++ b/sysdeps/x86_64/multiarch/memcmp.c
> > @@ -29,6 +29,8 @@
> >  libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR ());
> >  # undef bcmp
> >  weak_alias (memcmp, bcmp)
> > +# undef __memcmpeq
> > +weak_alias (memcmp, __memcmpeq)
> >
> >  # ifdef SHARED
> >  __hidden_ver1 (memcmp, __GI_memcmp, __redirect_memcmp)
> > --
> > 2.25.1
> >
>
> Ping.
Ping2.
H.J. Lu Oct. 21, 2021, 7:28 p.m. UTC | #4
On Wed, Sep 29, 2021 at 10:17:43AM -0500, GNU C Library wrote:
> No bug.
> 
> This commit adds support for __memcmpeq() as a new ABI for all
> targets. In this commit __memcmpeq() is implemented only as an alias
> to the corresponding targets memcmp() implementation. __memcmpeq() is
> added as a new symbol starting with GLIBC_2.35 and defined in string.h
> with comments explaining its behavior. Basic tests that it is callable
> and works where added in string/tester.c
> 
> As discussed in the proposal "Add new ABI '__memcmpeq()' to libc"
> __memcmpeq() is essentially a reserved namespace for bcmp(). The means
> is shares the same specifications as memcmp() except the return value
> for non-equal byte sequences is any non-zero value. This is less
> strict than memcmp()'s return value specification and can be better
> optimized when a boolean return is all that is needed.
> 
> __memcmpeq() is meant to only be called by compilers if they can prove
> that the return value of a memcmp() call is only used for its boolean
> value.
> 
> All tests in string/tester.c passed. As well build succeeds on
> x86_64-linux-gnu target.
> ---
>  string/Versions                                  |  3 +++
>  string/memcmp.c                                  |  2 ++
>  string/string.h                                  | 16 ++++++++++++++++
>  string/tester.c                                  | 16 ++++++++++++++++
>  sysdeps/aarch64/memcmp.S                         |  2 ++
>  sysdeps/csky/abiv2/memcmp.S                      |  1 +
>  sysdeps/i386/i686/memcmp.S                       |  2 ++
>  sysdeps/i386/i686/multiarch/memcmp.c             |  1 +
>  sysdeps/i386/memcmp.S                            |  2 ++
>  sysdeps/ia64/memcmp.S                            |  1 +
>  sysdeps/mach/hurd/i386/libc.abilist              |  1 +
>  sysdeps/powerpc/powerpc32/405/memcmp.S           |  1 +
>  sysdeps/powerpc/powerpc32/power4/memcmp.S        |  1 +
>  sysdeps/powerpc/powerpc32/power7/memcmp.S        |  1 +
>  sysdeps/powerpc/powerpc64/le/power10/memcmp.S    |  1 +
>  sysdeps/powerpc/powerpc64/power4/memcmp.S        |  1 +
>  sysdeps/powerpc/powerpc64/power7/memcmp.S        |  1 +
>  sysdeps/powerpc/powerpc64/power8/memcmp.S        |  1 +
>  sysdeps/s390/memcmp-z900.S                       |  1 +
>  sysdeps/s390/memcmp.c                            |  1 +
>  sysdeps/sparc/sparc64/memcmp.S                   |  2 ++
>  sysdeps/unix/sysv/linux/aarch64/libc.abilist     |  1 +
>  sysdeps/unix/sysv/linux/alpha/libc.abilist       |  1 +
>  sysdeps/unix/sysv/linux/arc/libc.abilist         |  1 +
>  sysdeps/unix/sysv/linux/arm/be/libc.abilist      |  1 +
>  sysdeps/unix/sysv/linux/arm/le/libc.abilist      |  1 +
>  sysdeps/unix/sysv/linux/csky/libc.abilist        |  1 +
>  sysdeps/unix/sysv/linux/hppa/libc.abilist        |  1 +
>  sysdeps/unix/sysv/linux/i386/libc.abilist        |  1 +
>  sysdeps/unix/sysv/linux/ia64/libc.abilist        |  1 +
>  .../unix/sysv/linux/m68k/coldfire/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist |  1 +
>  .../unix/sysv/linux/microblaze/be/libc.abilist   |  1 +
>  .../unix/sysv/linux/microblaze/le/libc.abilist   |  1 +
>  .../unix/sysv/linux/mips/mips32/fpu/libc.abilist |  1 +
>  .../sysv/linux/mips/mips32/nofpu/libc.abilist    |  1 +
>  .../unix/sysv/linux/mips/mips64/n32/libc.abilist |  1 +
>  .../unix/sysv/linux/mips/mips64/n64/libc.abilist |  1 +
>  sysdeps/unix/sysv/linux/nios2/libc.abilist       |  1 +
>  .../linux/powerpc/powerpc32/fpu/libc.abilist     |  1 +
>  .../linux/powerpc/powerpc32/nofpu/libc.abilist   |  1 +
>  .../sysv/linux/powerpc/powerpc64/be/libc.abilist |  1 +
>  .../sysv/linux/powerpc/powerpc64/le/libc.abilist |  1 +
>  sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist  |  1 +
>  sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist  |  1 +
>  .../unix/sysv/linux/s390/s390-32/libc.abilist    |  1 +
>  .../unix/sysv/linux/s390/s390-64/libc.abilist    |  1 +
>  sysdeps/unix/sysv/linux/sh/be/libc.abilist       |  1 +
>  sysdeps/unix/sysv/linux/sh/le/libc.abilist       |  1 +
>  .../unix/sysv/linux/sparc/sparc32/libc.abilist   |  1 +
>  .../unix/sysv/linux/sparc/sparc64/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/x86_64/64/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist  |  1 +
>  sysdeps/x86_64/memcmp.S                          |  2 ++
>  sysdeps/x86_64/multiarch/memcmp.c                |  2 ++
>  55 files changed, 94 insertions(+)
> 
> diff --git a/string/Versions b/string/Versions
> index 298ecd401a..864c4cf7a4 100644
> --- a/string/Versions
> +++ b/string/Versions
> @@ -89,4 +89,7 @@ libc {
>      sigdescr_np; sigabbrev_np;
>      strerrordesc_np; strerrorname_np;
>    }
> +  GLIBC_2.35 {
> +    __memcmpeq;
> +  }
>  }
> diff --git a/string/memcmp.c b/string/memcmp.c
> index 9b46d7a905..5020be00e0 100644
> --- a/string/memcmp.c
> +++ b/string/memcmp.c
> @@ -358,4 +358,6 @@ libc_hidden_builtin_def(memcmp)
>  #ifdef weak_alias
>  # undef bcmp
>  weak_alias (memcmp, bcmp)
> +# undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  #endif
> diff --git a/string/string.h b/string/string.h
> index 04e1b7067d..d0b714f836 100644
> --- a/string/string.h
> +++ b/string/string.h
> @@ -64,6 +64,22 @@ extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
>  extern int memcmp (const void *__s1, const void *__s2, size_t __n)
>       __THROW __attribute_pure__ __nonnull ((1, 2));
>  
> +/* Compare N bytes of S1 and S2.  Return zero if S1 and S2 are equal.
> +   Return some non-zero value otherwise.
> +
> +   Essentially __memcmpeq has the exact same semantics as memcmp
> +   except the return value is less constrained.  memcmp is always a
> +   correct implementation of __memcmpeq.  As well !!memcmp, -memcmp,
> +   or bcmp are correct implementations.
> +
> +   __memcmpeq is meant to be used by compilers when memcmp return is
> +   only used for its bolean value.
> +
> +   __memcmpeq is declared only for use by compilers.  Programs should
> +   continue to use memcmp.  */
> +extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n)
> +     __THROW __attribute_pure__ __nonnull ((1, 2));

Please add an internal one in include/string.h so that it can be called 
within libc.so bypassing PLT.  Find one place in glibc where __memcmpeq
can be used and use it.

Thanks.

> +
>  /* Search N bytes of S for C.  */
>  #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
>  extern "C++"
> diff --git a/string/tester.c b/string/tester.c
> index 778160ae6e..605b3f00f9 100644
> --- a/string/tester.c
> +++ b/string/tester.c
> @@ -1449,6 +1449,19 @@ test_bcmp (void)
>    check(bcmp("abc", "def", 0) == 0, 8);	/* Zero count. */
>  }
>  
> +static void
> +test_memcmpeq (void)
> +{
> +  it = "__memcmpeq";
> +  check (__memcmpeq ("a", "a", 1) == 0, 1); /* Identity.  */
> +  check (__memcmpeq ("abc", "abc", 3) == 0, 2); /* Multicharacter.  */
> +  check (__memcmpeq ("abcd", "abce", 4) != 0, 3); /* Honestly unequal.  */
> +  check (__memcmpeq ("abce", "abcd", 4) != 0, 4);
> +  check (__memcmpeq ("alph", "beta", 4) != 0, 5);
> +  check (__memcmpeq ("abce", "abcd", 3) == 0, 6); /* Count limited.  */
> +  check (__memcmpeq ("abc", "def", 0) == 0, 8); /* Zero count.  */
> +}
> +
>  static void
>  test_strerror (void)
>  {
> @@ -1611,6 +1624,9 @@ main (void)
>    /* bcmp - somewhat like memcmp.  */
>    test_bcmp ();
>  
> +  /* __memcmpeq - somewhat like memcmp.  */
> +  test_memcmpeq ();
> +
>    /* strndup.  */
>    test_strndup ();
>  
> diff --git a/sysdeps/aarch64/memcmp.S b/sysdeps/aarch64/memcmp.S
> index c1937f6f5c..bc932eff2a 100644
> --- a/sysdeps/aarch64/memcmp.S
> +++ b/sysdeps/aarch64/memcmp.S
> @@ -177,4 +177,6 @@ L(ret_0):
>  END (memcmp)
>  #undef bcmp
>  weak_alias (memcmp, bcmp)
> +#undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/csky/abiv2/memcmp.S b/sysdeps/csky/abiv2/memcmp.S
> index 1560387618..d61fca0f29 100644
> --- a/sysdeps/csky/abiv2/memcmp.S
> +++ b/sysdeps/csky/abiv2/memcmp.S
> @@ -138,5 +138,6 @@ ENTRY (memcmp)
>  	br	.L_s1_aligned
>  END (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_def (memcmp)
>  .weak memcmp
> diff --git a/sysdeps/i386/i686/memcmp.S b/sysdeps/i386/i686/memcmp.S
> index b26b124fad..0194f8deab 100644
> --- a/sysdeps/i386/i686/memcmp.S
> +++ b/sysdeps/i386/i686/memcmp.S
> @@ -405,4 +405,6 @@ L(table_32bytes) :
>  
>  #undef bcmp
>  weak_alias (memcmp, bcmp)
> +#undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/i386/i686/multiarch/memcmp.c b/sysdeps/i386/i686/multiarch/memcmp.c
> index 6e058a8857..956fc8e601 100644
> --- a/sysdeps/i386/i686/multiarch/memcmp.c
> +++ b/sysdeps/i386/i686/multiarch/memcmp.c
> @@ -29,4 +29,5 @@
>  libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR ());
>  
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
>  #endif
> diff --git a/sysdeps/i386/memcmp.S b/sysdeps/i386/memcmp.S
> index 1f212b0f6d..18e225f963 100644
> --- a/sysdeps/i386/memcmp.S
> +++ b/sysdeps/i386/memcmp.S
> @@ -70,4 +70,6 @@ END (memcmp)
>  
>  #undef bcmp
>  weak_alias (memcmp, bcmp)
> +#undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/ia64/memcmp.S b/sysdeps/ia64/memcmp.S
> index 97539c23fd..4488e0eba4 100644
> --- a/sysdeps/ia64/memcmp.S
> +++ b/sysdeps/ia64/memcmp.S
> @@ -160,4 +160,5 @@ ENTRY(memcmp)
>  END(memcmp)
>  
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
> index c5da10a0cd..e849d6fa35 100644
> --- a/sysdeps/mach/hurd/i386/libc.abilist
> +++ b/sysdeps/mach/hurd/i386/libc.abilist
> @@ -2285,6 +2285,7 @@ GLIBC_2.34 res_send F
>  GLIBC_2.34 shm_open F
>  GLIBC_2.34 shm_unlink F
>  GLIBC_2.34 timespec_getres F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/powerpc/powerpc32/405/memcmp.S b/sysdeps/powerpc/powerpc32/405/memcmp.S
> index 6a6a54d90f..e8b1b6c9bd 100644
> --- a/sysdeps/powerpc/powerpc32/405/memcmp.S
> +++ b/sysdeps/powerpc/powerpc32/405/memcmp.S
> @@ -126,3 +126,4 @@ L(st2):
>  END (memcmp)
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp,bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc32/power4/memcmp.S b/sysdeps/powerpc/powerpc32/power4/memcmp.S
> index 814d2f211d..e4dde875bb 100644
> --- a/sysdeps/powerpc/powerpc32/power4/memcmp.S
> +++ b/sysdeps/powerpc/powerpc32/power4/memcmp.S
> @@ -1373,3 +1373,4 @@ END (memcmp)
>  
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc32/power7/memcmp.S b/sysdeps/powerpc/powerpc32/power7/memcmp.S
> index 8a19953e2d..e60a62fc86 100644
> --- a/sysdeps/powerpc/powerpc32/power7/memcmp.S
> +++ b/sysdeps/powerpc/powerpc32/power7/memcmp.S
> @@ -1373,3 +1373,4 @@ END (memcmp)
>  
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc64/le/power10/memcmp.S b/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> index 52f244e7e7..c7fe8047ca 100644
> --- a/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> +++ b/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> @@ -177,3 +177,4 @@ L(tail8):
>  END (MEMCMP)
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc64/power4/memcmp.S b/sysdeps/powerpc/powerpc64/power4/memcmp.S
> index dc1be3a0d8..4ab4a90496 100644
> --- a/sysdeps/powerpc/powerpc64/power4/memcmp.S
> +++ b/sysdeps/powerpc/powerpc64/power4/memcmp.S
> @@ -1374,3 +1374,4 @@ L(duzeroLength):
>  END (MEMCMP)
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc64/power7/memcmp.S b/sysdeps/powerpc/powerpc64/power7/memcmp.S
> index bc034a55bc..b541978b5f 100644
> --- a/sysdeps/powerpc/powerpc64/power7/memcmp.S
> +++ b/sysdeps/powerpc/powerpc64/power7/memcmp.S
> @@ -1059,3 +1059,4 @@ L(duzeroLength):
>  END (MEMCMP)
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/powerpc/powerpc64/power8/memcmp.S b/sysdeps/powerpc/powerpc64/power8/memcmp.S
> index b676b09a9b..d4f84a5b6f 100644
> --- a/sysdeps/powerpc/powerpc64/power8/memcmp.S
> +++ b/sysdeps/powerpc/powerpc64/power8/memcmp.S
> @@ -1442,3 +1442,4 @@ L(duzeroLength):
>  END (MEMCMP)
>  libc_hidden_builtin_def (memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
> diff --git a/sysdeps/s390/memcmp-z900.S b/sysdeps/s390/memcmp-z900.S
> index 995d52e47d..0942d32814 100644
> --- a/sysdeps/s390/memcmp-z900.S
> +++ b/sysdeps/s390/memcmp-z900.S
> @@ -164,6 +164,7 @@ END(MEMCMP_Z196)
>     Otherwise see sysdeps/s390/memcmp.c.  */
>  strong_alias (MEMCMP_DEFAULT, memcmp)
>  weak_alias (memcmp, bcmp)
> +weak_alias (memcmp, __memcmpeq)
>  #endif
>  
>  #if defined SHARED && IS_IN (libc)
> diff --git a/sysdeps/s390/memcmp.c b/sysdeps/s390/memcmp.c
> index 0b4e9da717..475fc45d3a 100644
> --- a/sysdeps/s390/memcmp.c
> +++ b/sysdeps/s390/memcmp.c
> @@ -46,4 +46,5 @@ s390_libc_ifunc_expr (__redirect_memcmp, memcmp,
>  		      })
>  		      )
>  weak_alias (memcmp, bcmp);
> +weak_alias (memcmp, __memcmpeq)
>  #endif
> diff --git a/sysdeps/sparc/sparc64/memcmp.S b/sysdeps/sparc/sparc64/memcmp.S
> index d8d9ff9b24..edcc19915a 100644
> --- a/sysdeps/sparc/sparc64/memcmp.S
> +++ b/sysdeps/sparc/sparc64/memcmp.S
> @@ -137,4 +137,6 @@ END(memcmp)
>  
>  #undef bcmp
>  weak_alias (memcmp, bcmp)
> +#undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> index 21a2e50a88..f227ae6cee 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> @@ -2612,3 +2612,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> index a201fd69ba..0ccc3fc73e 100644
> --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> @@ -2709,6 +2709,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
> index 2611436937..fd80704787 100644
> --- a/sysdeps/unix/sysv/linux/arc/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
> @@ -2373,3 +2373,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> index a426241965..2ae6c58b8a 100644
> --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> @@ -491,6 +491,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> index 02f80418cc..fcfd1e8594 100644
> --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> @@ -488,6 +488,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
> index b7676eb372..ba034b8541 100644
> --- a/sysdeps/unix/sysv/linux/csky/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
> @@ -2647,3 +2647,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> index f6965c9d95..b7460bec8a 100644
> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> @@ -2596,6 +2596,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
> index 2e7603d9ed..a4dc341ded 100644
> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
> @@ -2780,6 +2780,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> index dd3a56d3fe..94b222dbc7 100644
> --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> @@ -2547,6 +2547,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> index c1e0ea9c10..12fd3b6310 100644
> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> @@ -492,6 +492,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0x98
>  GLIBC_2.4 _IO_2_1_stdin_ D 0x98
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> index 93161048ca..4d2296007a 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> @@ -2723,6 +2723,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> index 0aaeec8a27..a223278a3d 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> @@ -2696,3 +2696,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> index bec5f456c9..780a4f5b0b 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> @@ -2693,3 +2693,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> index 97d2127f78..cd65136062 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> @@ -2688,6 +2688,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> index acb0756c11..b5b9902db5 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> @@ -2686,6 +2686,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> index ebc21dde1e..57593d5f94 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> @@ -2694,6 +2694,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> index c68f7e3c6c..e944d76bed 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> @@ -2598,6 +2598,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> index e5b6834f14..8af5a3a90d 100644
> --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> @@ -2735,3 +2735,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> index 132707c8ad..3a0213b39f 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> @@ -2750,6 +2750,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> index 0af2be31a0..f57df0234b 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> @@ -2783,6 +2783,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> index cf864632d0..259a0cfc51 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> @@ -2506,6 +2506,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> index d566d675d0..126541daf1 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> @@ -2808,3 +2808,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> index c9a7eacb32..05df4d13d2 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> @@ -2375,3 +2375,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> index 8299131cb2..8e349cbff8 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> @@ -2575,3 +2575,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> index c3fe78f77f..e9de402766 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> @@ -2748,6 +2748,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> index 83e542aa8c..1a010c745d 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> @@ -2543,6 +2543,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> index dc502f6833..22ce530975 100644
> --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> @@ -2603,6 +2603,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> index cba1abb556..960df07b83 100644
> --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> @@ -2600,6 +2600,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> index d4a516fb47..eedb376f3d 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> @@ -2743,6 +2743,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> index 6268875ba3..86e0c92bef 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> @@ -2570,6 +2570,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> index 095e914b73..5e59d90623 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> @@ -2521,6 +2521,7 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> index dd910f7fe9..94412dc134 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> @@ -2627,3 +2627,4 @@ GLIBC_2.34 tss_create F
>  GLIBC_2.34 tss_delete F
>  GLIBC_2.34 tss_get F
>  GLIBC_2.34 tss_set F
> +GLIBC_2.35 __memcmpeq F
> diff --git a/sysdeps/x86_64/memcmp.S b/sysdeps/x86_64/memcmp.S
> index 870e15c5a0..f41ae48006 100644
> --- a/sysdeps/x86_64/memcmp.S
> +++ b/sysdeps/x86_64/memcmp.S
> @@ -358,4 +358,6 @@ END(memcmp)
>  
>  #undef bcmp
>  weak_alias (memcmp, bcmp)
> +#undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  libc_hidden_builtin_def (memcmp)
> diff --git a/sysdeps/x86_64/multiarch/memcmp.c b/sysdeps/x86_64/multiarch/memcmp.c
> index fe725f3563..fe125e0904 100644
> --- a/sysdeps/x86_64/multiarch/memcmp.c
> +++ b/sysdeps/x86_64/multiarch/memcmp.c
> @@ -29,6 +29,8 @@
>  libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR ());
>  # undef bcmp
>  weak_alias (memcmp, bcmp)
> +# undef __memcmpeq
> +weak_alias (memcmp, __memcmpeq)
>  
>  # ifdef SHARED
>  __hidden_ver1 (memcmp, __GI_memcmp, __redirect_memcmp)
> -- 
> 2.25.1
>
Adhemerval Zanella Oct. 21, 2021, 7:33 p.m. UTC | #5
On 29/09/2021 12:17, Noah Goldstein via Libc-alpha wrote:
> No bug.
> 
> This commit adds support for __memcmpeq() as a new ABI for all
> targets. In this commit __memcmpeq() is implemented only as an alias
> to the corresponding targets memcmp() implementation. __memcmpeq() is
> added as a new symbol starting with GLIBC_2.35 and defined in string.h
> with comments explaining its behavior. Basic tests that it is callable
> and works where added in string/tester.c
> 
> As discussed in the proposal "Add new ABI '__memcmpeq()' to libc"
> __memcmpeq() is essentially a reserved namespace for bcmp(). The means
> is shares the same specifications as memcmp() except the return value
> for non-equal byte sequences is any non-zero value. This is less
> strict than memcmp()'s return value specification and can be better
> optimized when a boolean return is all that is needed.
> 
> __memcmpeq() is meant to only be called by compilers if they can prove
> that the return value of a memcmp() call is only used for its boolean
> value.
> 

Should we export memcmpeq() as a GNU extension as well?

> All tests in string/tester.c passed. As well build succeeds on
> x86_64-linux-gnu target.

This patch requires a NEWS entry for the new symbol and most likely
a manual entry to describe its semantic. 

I also think we should model a new testing based on test-memcmp.c
to check for multiple alignments and random inputs.
Noah Goldstein Oct. 21, 2021, 7:58 p.m. UTC | #6
On Thu, Oct 21, 2021 at 2:28 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Wed, Sep 29, 2021 at 10:17:43AM -0500, GNU C Library wrote:
> > No bug.
> >
> > This commit adds support for __memcmpeq() as a new ABI for all
> > targets. In this commit __memcmpeq() is implemented only as an alias
> > to the corresponding targets memcmp() implementation. __memcmpeq() is
> > added as a new symbol starting with GLIBC_2.35 and defined in string.h
> > with comments explaining its behavior. Basic tests that it is callable
> > and works where added in string/tester.c
> >
> > As discussed in the proposal "Add new ABI '__memcmpeq()' to libc"
> > __memcmpeq() is essentially a reserved namespace for bcmp(). The means
> > is shares the same specifications as memcmp() except the return value
> > for non-equal byte sequences is any non-zero value. This is less
> > strict than memcmp()'s return value specification and can be better
> > optimized when a boolean return is all that is needed.
> >
> > __memcmpeq() is meant to only be called by compilers if they can prove
> > that the return value of a memcmp() call is only used for its boolean
> > value.
> >
> > All tests in string/tester.c passed. As well build succeeds on
> > x86_64-linux-gnu target.
> > ---
> >  string/Versions                                  |  3 +++
> >  string/memcmp.c                                  |  2 ++
> >  string/string.h                                  | 16 ++++++++++++++++
> >  string/tester.c                                  | 16 ++++++++++++++++
> >  sysdeps/aarch64/memcmp.S                         |  2 ++
> >  sysdeps/csky/abiv2/memcmp.S                      |  1 +
> >  sysdeps/i386/i686/memcmp.S                       |  2 ++
> >  sysdeps/i386/i686/multiarch/memcmp.c             |  1 +
> >  sysdeps/i386/memcmp.S                            |  2 ++
> >  sysdeps/ia64/memcmp.S                            |  1 +
> >  sysdeps/mach/hurd/i386/libc.abilist              |  1 +
> >  sysdeps/powerpc/powerpc32/405/memcmp.S           |  1 +
> >  sysdeps/powerpc/powerpc32/power4/memcmp.S        |  1 +
> >  sysdeps/powerpc/powerpc32/power7/memcmp.S        |  1 +
> >  sysdeps/powerpc/powerpc64/le/power10/memcmp.S    |  1 +
> >  sysdeps/powerpc/powerpc64/power4/memcmp.S        |  1 +
> >  sysdeps/powerpc/powerpc64/power7/memcmp.S        |  1 +
> >  sysdeps/powerpc/powerpc64/power8/memcmp.S        |  1 +
> >  sysdeps/s390/memcmp-z900.S                       |  1 +
> >  sysdeps/s390/memcmp.c                            |  1 +
> >  sysdeps/sparc/sparc64/memcmp.S                   |  2 ++
> >  sysdeps/unix/sysv/linux/aarch64/libc.abilist     |  1 +
> >  sysdeps/unix/sysv/linux/alpha/libc.abilist       |  1 +
> >  sysdeps/unix/sysv/linux/arc/libc.abilist         |  1 +
> >  sysdeps/unix/sysv/linux/arm/be/libc.abilist      |  1 +
> >  sysdeps/unix/sysv/linux/arm/le/libc.abilist      |  1 +
> >  sysdeps/unix/sysv/linux/csky/libc.abilist        |  1 +
> >  sysdeps/unix/sysv/linux/hppa/libc.abilist        |  1 +
> >  sysdeps/unix/sysv/linux/i386/libc.abilist        |  1 +
> >  sysdeps/unix/sysv/linux/ia64/libc.abilist        |  1 +
> >  .../unix/sysv/linux/m68k/coldfire/libc.abilist   |  1 +
> >  sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist |  1 +
> >  .../unix/sysv/linux/microblaze/be/libc.abilist   |  1 +
> >  .../unix/sysv/linux/microblaze/le/libc.abilist   |  1 +
> >  .../unix/sysv/linux/mips/mips32/fpu/libc.abilist |  1 +
> >  .../sysv/linux/mips/mips32/nofpu/libc.abilist    |  1 +
> >  .../unix/sysv/linux/mips/mips64/n32/libc.abilist |  1 +
> >  .../unix/sysv/linux/mips/mips64/n64/libc.abilist |  1 +
> >  sysdeps/unix/sysv/linux/nios2/libc.abilist       |  1 +
> >  .../linux/powerpc/powerpc32/fpu/libc.abilist     |  1 +
> >  .../linux/powerpc/powerpc32/nofpu/libc.abilist   |  1 +
> >  .../sysv/linux/powerpc/powerpc64/be/libc.abilist |  1 +
> >  .../sysv/linux/powerpc/powerpc64/le/libc.abilist |  1 +
> >  sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist  |  1 +
> >  sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist  |  1 +
> >  .../unix/sysv/linux/s390/s390-32/libc.abilist    |  1 +
> >  .../unix/sysv/linux/s390/s390-64/libc.abilist    |  1 +
> >  sysdeps/unix/sysv/linux/sh/be/libc.abilist       |  1 +
> >  sysdeps/unix/sysv/linux/sh/le/libc.abilist       |  1 +
> >  .../unix/sysv/linux/sparc/sparc32/libc.abilist   |  1 +
> >  .../unix/sysv/linux/sparc/sparc64/libc.abilist   |  1 +
> >  sysdeps/unix/sysv/linux/x86_64/64/libc.abilist   |  1 +
> >  sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist  |  1 +
> >  sysdeps/x86_64/memcmp.S                          |  2 ++
> >  sysdeps/x86_64/multiarch/memcmp.c                |  2 ++
> >  55 files changed, 94 insertions(+)
> >
> > diff --git a/string/Versions b/string/Versions
> > index 298ecd401a..864c4cf7a4 100644
> > --- a/string/Versions
> > +++ b/string/Versions
> > @@ -89,4 +89,7 @@ libc {
> >      sigdescr_np; sigabbrev_np;
> >      strerrordesc_np; strerrorname_np;
> >    }
> > +  GLIBC_2.35 {
> > +    __memcmpeq;
> > +  }
> >  }
> > diff --git a/string/memcmp.c b/string/memcmp.c
> > index 9b46d7a905..5020be00e0 100644
> > --- a/string/memcmp.c
> > +++ b/string/memcmp.c
> > @@ -358,4 +358,6 @@ libc_hidden_builtin_def(memcmp)
> >  #ifdef weak_alias
> >  # undef bcmp
> >  weak_alias (memcmp, bcmp)
> > +# undef __memcmpeq
> > +weak_alias (memcmp, __memcmpeq)
> >  #endif
> > diff --git a/string/string.h b/string/string.h
> > index 04e1b7067d..d0b714f836 100644
> > --- a/string/string.h
> > +++ b/string/string.h
> > @@ -64,6 +64,22 @@ extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
> >  extern int memcmp (const void *__s1, const void *__s2, size_t __n)
> >       __THROW __attribute_pure__ __nonnull ((1, 2));
> >
> > +/* Compare N bytes of S1 and S2.  Return zero if S1 and S2 are equal.
> > +   Return some non-zero value otherwise.
> > +
> > +   Essentially __memcmpeq has the exact same semantics as memcmp
> > +   except the return value is less constrained.  memcmp is always a
> > +   correct implementation of __memcmpeq.  As well !!memcmp, -memcmp,
> > +   or bcmp are correct implementations.
> > +
> > +   __memcmpeq is meant to be used by compilers when memcmp return is
> > +   only used for its bolean value.
> > +
> > +   __memcmpeq is declared only for use by compilers.  Programs should
> > +   continue to use memcmp.  */
> > +extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n)
> > +     __THROW __attribute_pure__ __nonnull ((1, 2));
>
> Please add an internal one in include/string.h so that it can be called
> within libc.so bypassing PLT.  Find one place in glibc where __memcmpeq
> can be used and use it.

Usage outside of a test? It is currently used directly in string/tester.c

>
> Thanks.
>
> > +
> >  /* Search N bytes of S for C.  */
> >  #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
> >  extern "C++"
> > diff --git a/string/tester.c b/string/tester.c
> > index 778160ae6e..605b3f00f9 100644
> > --- a/string/tester.c
> > +++ b/string/tester.c
> > @@ -1449,6 +1449,19 @@ test_bcmp (void)
> >    check(bcmp("abc", "def", 0) == 0, 8);      /* Zero count. */
> >  }
> >
> > +static void
> > +test_memcmpeq (void)
> > +{
> > +  it = "__memcmpeq";
> > +  check (__memcmpeq ("a", "a", 1) == 0, 1); /* Identity.  */
> > +  check (__memcmpeq ("abc", "abc", 3) == 0, 2); /* Multicharacter.  */
> > +  check (__memcmpeq ("abcd", "abce", 4) != 0, 3); /* Honestly unequal.  */
> > +  check (__memcmpeq ("abce", "abcd", 4) != 0, 4);
> > +  check (__memcmpeq ("alph", "beta", 4) != 0, 5);
> > +  check (__memcmpeq ("abce", "abcd", 3) == 0, 6); /* Count limited.  */
> > +  check (__memcmpeq ("abc", "def", 0) == 0, 8); /* Zero count.  */
> > +}
> > +
> >  static void
> >  test_strerror (void)
> >  {
> > @@ -1611,6 +1624,9 @@ main (void)
> >    /* bcmp - somewhat like memcmp.  */
> >    test_bcmp ();
> >
> > +  /* __memcmpeq - somewhat like memcmp.  */
> > +  test_memcmpeq ();
> > +
> >    /* strndup.  */
> >    test_strndup ();
> >
> > diff --git a/sysdeps/aarch64/memcmp.S b/sysdeps/aarch64/memcmp.S
> > index c1937f6f5c..bc932eff2a 100644
> > --- a/sysdeps/aarch64/memcmp.S
> > +++ b/sysdeps/aarch64/memcmp.S
> > @@ -177,4 +177,6 @@ L(ret_0):
> >  END (memcmp)
> >  #undef bcmp
> >  weak_alias (memcmp, bcmp)
> > +#undef __memcmpeq
> > +weak_alias (memcmp, __memcmpeq)
> >  libc_hidden_builtin_def (memcmp)
> > diff --git a/sysdeps/csky/abiv2/memcmp.S b/sysdeps/csky/abiv2/memcmp.S
> > index 1560387618..d61fca0f29 100644
> > --- a/sysdeps/csky/abiv2/memcmp.S
> > +++ b/sysdeps/csky/abiv2/memcmp.S
> > @@ -138,5 +138,6 @@ ENTRY (memcmp)
> >       br      .L_s1_aligned
> >  END (memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> >  libc_hidden_def (memcmp)
> >  .weak memcmp
> > diff --git a/sysdeps/i386/i686/memcmp.S b/sysdeps/i386/i686/memcmp.S
> > index b26b124fad..0194f8deab 100644
> > --- a/sysdeps/i386/i686/memcmp.S
> > +++ b/sysdeps/i386/i686/memcmp.S
> > @@ -405,4 +405,6 @@ L(table_32bytes) :
> >
> >  #undef bcmp
> >  weak_alias (memcmp, bcmp)
> > +#undef __memcmpeq
> > +weak_alias (memcmp, __memcmpeq)
> >  libc_hidden_builtin_def (memcmp)
> > diff --git a/sysdeps/i386/i686/multiarch/memcmp.c b/sysdeps/i386/i686/multiarch/memcmp.c
> > index 6e058a8857..956fc8e601 100644
> > --- a/sysdeps/i386/i686/multiarch/memcmp.c
> > +++ b/sysdeps/i386/i686/multiarch/memcmp.c
> > @@ -29,4 +29,5 @@
> >  libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR ());
> >
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> >  #endif
> > diff --git a/sysdeps/i386/memcmp.S b/sysdeps/i386/memcmp.S
> > index 1f212b0f6d..18e225f963 100644
> > --- a/sysdeps/i386/memcmp.S
> > +++ b/sysdeps/i386/memcmp.S
> > @@ -70,4 +70,6 @@ END (memcmp)
> >
> >  #undef bcmp
> >  weak_alias (memcmp, bcmp)
> > +#undef __memcmpeq
> > +weak_alias (memcmp, __memcmpeq)
> >  libc_hidden_builtin_def (memcmp)
> > diff --git a/sysdeps/ia64/memcmp.S b/sysdeps/ia64/memcmp.S
> > index 97539c23fd..4488e0eba4 100644
> > --- a/sysdeps/ia64/memcmp.S
> > +++ b/sysdeps/ia64/memcmp.S
> > @@ -160,4 +160,5 @@ ENTRY(memcmp)
> >  END(memcmp)
> >
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> >  libc_hidden_builtin_def (memcmp)
> > diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
> > index c5da10a0cd..e849d6fa35 100644
> > --- a/sysdeps/mach/hurd/i386/libc.abilist
> > +++ b/sysdeps/mach/hurd/i386/libc.abilist
> > @@ -2285,6 +2285,7 @@ GLIBC_2.34 res_send F
> >  GLIBC_2.34 shm_open F
> >  GLIBC_2.34 shm_unlink F
> >  GLIBC_2.34 timespec_getres F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/powerpc/powerpc32/405/memcmp.S b/sysdeps/powerpc/powerpc32/405/memcmp.S
> > index 6a6a54d90f..e8b1b6c9bd 100644
> > --- a/sysdeps/powerpc/powerpc32/405/memcmp.S
> > +++ b/sysdeps/powerpc/powerpc32/405/memcmp.S
> > @@ -126,3 +126,4 @@ L(st2):
> >  END (memcmp)
> >  libc_hidden_builtin_def (memcmp)
> >  weak_alias (memcmp,bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> > diff --git a/sysdeps/powerpc/powerpc32/power4/memcmp.S b/sysdeps/powerpc/powerpc32/power4/memcmp.S
> > index 814d2f211d..e4dde875bb 100644
> > --- a/sysdeps/powerpc/powerpc32/power4/memcmp.S
> > +++ b/sysdeps/powerpc/powerpc32/power4/memcmp.S
> > @@ -1373,3 +1373,4 @@ END (memcmp)
> >
> >  libc_hidden_builtin_def (memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> > diff --git a/sysdeps/powerpc/powerpc32/power7/memcmp.S b/sysdeps/powerpc/powerpc32/power7/memcmp.S
> > index 8a19953e2d..e60a62fc86 100644
> > --- a/sysdeps/powerpc/powerpc32/power7/memcmp.S
> > +++ b/sysdeps/powerpc/powerpc32/power7/memcmp.S
> > @@ -1373,3 +1373,4 @@ END (memcmp)
> >
> >  libc_hidden_builtin_def (memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> > diff --git a/sysdeps/powerpc/powerpc64/le/power10/memcmp.S b/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> > index 52f244e7e7..c7fe8047ca 100644
> > --- a/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> > +++ b/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
> > @@ -177,3 +177,4 @@ L(tail8):
> >  END (MEMCMP)
> >  libc_hidden_builtin_def (memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> > diff --git a/sysdeps/powerpc/powerpc64/power4/memcmp.S b/sysdeps/powerpc/powerpc64/power4/memcmp.S
> > index dc1be3a0d8..4ab4a90496 100644
> > --- a/sysdeps/powerpc/powerpc64/power4/memcmp.S
> > +++ b/sysdeps/powerpc/powerpc64/power4/memcmp.S
> > @@ -1374,3 +1374,4 @@ L(duzeroLength):
> >  END (MEMCMP)
> >  libc_hidden_builtin_def (memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> > diff --git a/sysdeps/powerpc/powerpc64/power7/memcmp.S b/sysdeps/powerpc/powerpc64/power7/memcmp.S
> > index bc034a55bc..b541978b5f 100644
> > --- a/sysdeps/powerpc/powerpc64/power7/memcmp.S
> > +++ b/sysdeps/powerpc/powerpc64/power7/memcmp.S
> > @@ -1059,3 +1059,4 @@ L(duzeroLength):
> >  END (MEMCMP)
> >  libc_hidden_builtin_def (memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> > diff --git a/sysdeps/powerpc/powerpc64/power8/memcmp.S b/sysdeps/powerpc/powerpc64/power8/memcmp.S
> > index b676b09a9b..d4f84a5b6f 100644
> > --- a/sysdeps/powerpc/powerpc64/power8/memcmp.S
> > +++ b/sysdeps/powerpc/powerpc64/power8/memcmp.S
> > @@ -1442,3 +1442,4 @@ L(duzeroLength):
> >  END (MEMCMP)
> >  libc_hidden_builtin_def (memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> > diff --git a/sysdeps/s390/memcmp-z900.S b/sysdeps/s390/memcmp-z900.S
> > index 995d52e47d..0942d32814 100644
> > --- a/sysdeps/s390/memcmp-z900.S
> > +++ b/sysdeps/s390/memcmp-z900.S
> > @@ -164,6 +164,7 @@ END(MEMCMP_Z196)
> >     Otherwise see sysdeps/s390/memcmp.c.  */
> >  strong_alias (MEMCMP_DEFAULT, memcmp)
> >  weak_alias (memcmp, bcmp)
> > +weak_alias (memcmp, __memcmpeq)
> >  #endif
> >
> >  #if defined SHARED && IS_IN (libc)
> > diff --git a/sysdeps/s390/memcmp.c b/sysdeps/s390/memcmp.c
> > index 0b4e9da717..475fc45d3a 100644
> > --- a/sysdeps/s390/memcmp.c
> > +++ b/sysdeps/s390/memcmp.c
> > @@ -46,4 +46,5 @@ s390_libc_ifunc_expr (__redirect_memcmp, memcmp,
> >                     })
> >                     )
> >  weak_alias (memcmp, bcmp);
> > +weak_alias (memcmp, __memcmpeq)
> >  #endif
> > diff --git a/sysdeps/sparc/sparc64/memcmp.S b/sysdeps/sparc/sparc64/memcmp.S
> > index d8d9ff9b24..edcc19915a 100644
> > --- a/sysdeps/sparc/sparc64/memcmp.S
> > +++ b/sysdeps/sparc/sparc64/memcmp.S
> > @@ -137,4 +137,6 @@ END(memcmp)
> >
> >  #undef bcmp
> >  weak_alias (memcmp, bcmp)
> > +#undef __memcmpeq
> > +weak_alias (memcmp, __memcmpeq)
> >  libc_hidden_builtin_def (memcmp)
> > diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> > index 21a2e50a88..f227ae6cee 100644
> > --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> > @@ -2612,3 +2612,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> > index a201fd69ba..0ccc3fc73e 100644
> > --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> > @@ -2709,6 +2709,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _IO_fprintf F
> >  GLIBC_2.4 _IO_printf F
> >  GLIBC_2.4 _IO_sprintf F
> > diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
> > index 2611436937..fd80704787 100644
> > --- a/sysdeps/unix/sysv/linux/arc/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
> > @@ -2373,3 +2373,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> > index a426241965..2ae6c58b8a 100644
> > --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> > @@ -491,6 +491,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _Exit F
> >  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
> >  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> > diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> > index 02f80418cc..fcfd1e8594 100644
> > --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> > @@ -488,6 +488,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _Exit F
> >  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
> >  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> > diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
> > index b7676eb372..ba034b8541 100644
> > --- a/sysdeps/unix/sysv/linux/csky/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
> > @@ -2647,3 +2647,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> > index f6965c9d95..b7460bec8a 100644
> > --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> > @@ -2596,6 +2596,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
> > index 2e7603d9ed..a4dc341ded 100644
> > --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
> > @@ -2780,6 +2780,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> > index dd3a56d3fe..94b222dbc7 100644
> > --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> > @@ -2547,6 +2547,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> > index c1e0ea9c10..12fd3b6310 100644
> > --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> > @@ -492,6 +492,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _Exit F
> >  GLIBC_2.4 _IO_2_1_stderr_ D 0x98
> >  GLIBC_2.4 _IO_2_1_stdin_ D 0x98
> > diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> > index 93161048ca..4d2296007a 100644
> > --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> > @@ -2723,6 +2723,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> > index 0aaeec8a27..a223278a3d 100644
> > --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> > @@ -2696,3 +2696,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> > index bec5f456c9..780a4f5b0b 100644
> > --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> > @@ -2693,3 +2693,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> > index 97d2127f78..cd65136062 100644
> > --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> > @@ -2688,6 +2688,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> > index acb0756c11..b5b9902db5 100644
> > --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> > @@ -2686,6 +2686,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> > index ebc21dde1e..57593d5f94 100644
> > --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> > @@ -2694,6 +2694,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> > index c68f7e3c6c..e944d76bed 100644
> > --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> > @@ -2598,6 +2598,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> > index e5b6834f14..8af5a3a90d 100644
> > --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> > @@ -2735,3 +2735,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> > index 132707c8ad..3a0213b39f 100644
> > --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> > @@ -2750,6 +2750,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _IO_fprintf F
> >  GLIBC_2.4 _IO_printf F
> >  GLIBC_2.4 _IO_sprintf F
> > diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> > index 0af2be31a0..f57df0234b 100644
> > --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> > @@ -2783,6 +2783,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _IO_fprintf F
> >  GLIBC_2.4 _IO_printf F
> >  GLIBC_2.4 _IO_sprintf F
> > diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> > index cf864632d0..259a0cfc51 100644
> > --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> > @@ -2506,6 +2506,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _IO_fprintf F
> >  GLIBC_2.4 _IO_printf F
> >  GLIBC_2.4 _IO_sprintf F
> > diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> > index d566d675d0..126541daf1 100644
> > --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> > @@ -2808,3 +2808,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> > index c9a7eacb32..05df4d13d2 100644
> > --- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> > @@ -2375,3 +2375,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> > index 8299131cb2..8e349cbff8 100644
> > --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> > @@ -2575,3 +2575,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> > index c3fe78f77f..e9de402766 100644
> > --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> > @@ -2748,6 +2748,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _IO_fprintf F
> >  GLIBC_2.4 _IO_printf F
> >  GLIBC_2.4 _IO_sprintf F
> > diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> > index 83e542aa8c..1a010c745d 100644
> > --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> > @@ -2543,6 +2543,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _IO_fprintf F
> >  GLIBC_2.4 _IO_printf F
> >  GLIBC_2.4 _IO_sprintf F
> > diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> > index dc502f6833..22ce530975 100644
> > --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> > @@ -2603,6 +2603,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> > index cba1abb556..960df07b83 100644
> > --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> > @@ -2600,6 +2600,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> > index d4a516fb47..eedb376f3d 100644
> > --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> > @@ -2743,6 +2743,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 _IO_fprintf F
> >  GLIBC_2.4 _IO_printf F
> >  GLIBC_2.4 _IO_sprintf F
> > diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> > index 6268875ba3..86e0c92bef 100644
> > --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> > @@ -2570,6 +2570,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> > index 095e914b73..5e59d90623 100644
> > --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> > @@ -2521,6 +2521,7 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> >  GLIBC_2.4 __confstr_chk F
> >  GLIBC_2.4 __fgets_chk F
> >  GLIBC_2.4 __fgets_unlocked_chk F
> > diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> > index dd910f7fe9..94412dc134 100644
> > --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> > +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> > @@ -2627,3 +2627,4 @@ GLIBC_2.34 tss_create F
> >  GLIBC_2.34 tss_delete F
> >  GLIBC_2.34 tss_get F
> >  GLIBC_2.34 tss_set F
> > +GLIBC_2.35 __memcmpeq F
> > diff --git a/sysdeps/x86_64/memcmp.S b/sysdeps/x86_64/memcmp.S
> > index 870e15c5a0..f41ae48006 100644
> > --- a/sysdeps/x86_64/memcmp.S
> > +++ b/sysdeps/x86_64/memcmp.S
> > @@ -358,4 +358,6 @@ END(memcmp)
> >
> >  #undef bcmp
> >  weak_alias (memcmp, bcmp)
> > +#undef __memcmpeq
> > +weak_alias (memcmp, __memcmpeq)
> >  libc_hidden_builtin_def (memcmp)
> > diff --git a/sysdeps/x86_64/multiarch/memcmp.c b/sysdeps/x86_64/multiarch/memcmp.c
> > index fe725f3563..fe125e0904 100644
> > --- a/sysdeps/x86_64/multiarch/memcmp.c
> > +++ b/sysdeps/x86_64/multiarch/memcmp.c
> > @@ -29,6 +29,8 @@
> >  libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR ());
> >  # undef bcmp
> >  weak_alias (memcmp, bcmp)
> > +# undef __memcmpeq
> > +weak_alias (memcmp, __memcmpeq)
> >
> >  # ifdef SHARED
> >  __hidden_ver1 (memcmp, __GI_memcmp, __redirect_memcmp)
> > --
> > 2.25.1
> >
H.J. Lu Oct. 21, 2021, 8 p.m. UTC | #7
On Thu, Oct 21, 2021 at 12:58 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> On Thu, Oct 21, 2021 at 2:28 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Wed, Sep 29, 2021 at 10:17:43AM -0500, GNU C Library wrote:
> > > No bug.
> > >
> > > This commit adds support for __memcmpeq() as a new ABI for all
> > > targets. In this commit __memcmpeq() is implemented only as an alias
> > > to the corresponding targets memcmp() implementation. __memcmpeq() is
> > > added as a new symbol starting with GLIBC_2.35 and defined in string.h
> > > with comments explaining its behavior. Basic tests that it is callable
> > > and works where added in string/tester.c
> > >
> > > As discussed in the proposal "Add new ABI '__memcmpeq()' to libc"
> > > __memcmpeq() is essentially a reserved namespace for bcmp(). The means
> > > is shares the same specifications as memcmp() except the return value
> > > for non-equal byte sequences is any non-zero value. This is less
> > > strict than memcmp()'s return value specification and can be better
> > > optimized when a boolean return is all that is needed.
> > >
> > > __memcmpeq() is meant to only be called by compilers if they can prove
> > > that the return value of a memcmp() call is only used for its boolean
> > > value.
> > >
> > > All tests in string/tester.c passed. As well build succeeds on
> > > x86_64-linux-gnu target.
> > > ---
> > >  string/Versions                                  |  3 +++
> > >  string/memcmp.c                                  |  2 ++
> > >  string/string.h                                  | 16 ++++++++++++++++
> > >  string/tester.c                                  | 16 ++++++++++++++++
> > >  sysdeps/aarch64/memcmp.S                         |  2 ++
> > >  sysdeps/csky/abiv2/memcmp.S                      |  1 +
> > >  sysdeps/i386/i686/memcmp.S                       |  2 ++
> > >  sysdeps/i386/i686/multiarch/memcmp.c             |  1 +
> > >  sysdeps/i386/memcmp.S                            |  2 ++
> > >  sysdeps/ia64/memcmp.S                            |  1 +
> > >  sysdeps/mach/hurd/i386/libc.abilist              |  1 +
> > >  sysdeps/powerpc/powerpc32/405/memcmp.S           |  1 +
> > >  sysdeps/powerpc/powerpc32/power4/memcmp.S        |  1 +
> > >  sysdeps/powerpc/powerpc32/power7/memcmp.S        |  1 +
> > >  sysdeps/powerpc/powerpc64/le/power10/memcmp.S    |  1 +
> > >  sysdeps/powerpc/powerpc64/power4/memcmp.S        |  1 +
> > >  sysdeps/powerpc/powerpc64/power7/memcmp.S        |  1 +
> > >  sysdeps/powerpc/powerpc64/power8/memcmp.S        |  1 +
> > >  sysdeps/s390/memcmp-z900.S                       |  1 +
> > >  sysdeps/s390/memcmp.c                            |  1 +
> > >  sysdeps/sparc/sparc64/memcmp.S                   |  2 ++
> > >  sysdeps/unix/sysv/linux/aarch64/libc.abilist     |  1 +
> > >  sysdeps/unix/sysv/linux/alpha/libc.abilist       |  1 +
> > >  sysdeps/unix/sysv/linux/arc/libc.abilist         |  1 +
> > >  sysdeps/unix/sysv/linux/arm/be/libc.abilist      |  1 +
> > >  sysdeps/unix/sysv/linux/arm/le/libc.abilist      |  1 +
> > >  sysdeps/unix/sysv/linux/csky/libc.abilist        |  1 +
> > >  sysdeps/unix/sysv/linux/hppa/libc.abilist        |  1 +
> > >  sysdeps/unix/sysv/linux/i386/libc.abilist        |  1 +
> > >  sysdeps/unix/sysv/linux/ia64/libc.abilist        |  1 +
> > >  .../unix/sysv/linux/m68k/coldfire/libc.abilist   |  1 +
> > >  sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist |  1 +
> > >  .../unix/sysv/linux/microblaze/be/libc.abilist   |  1 +
> > >  .../unix/sysv/linux/microblaze/le/libc.abilist   |  1 +
> > >  .../unix/sysv/linux/mips/mips32/fpu/libc.abilist |  1 +
> > >  .../sysv/linux/mips/mips32/nofpu/libc.abilist    |  1 +
> > >  .../unix/sysv/linux/mips/mips64/n32/libc.abilist |  1 +
> > >  .../unix/sysv/linux/mips/mips64/n64/libc.abilist |  1 +
> > >  sysdeps/unix/sysv/linux/nios2/libc.abilist       |  1 +
> > >  .../linux/powerpc/powerpc32/fpu/libc.abilist     |  1 +
> > >  .../linux/powerpc/powerpc32/nofpu/libc.abilist   |  1 +
> > >  .../sysv/linux/powerpc/powerpc64/be/libc.abilist |  1 +
> > >  .../sysv/linux/powerpc/powerpc64/le/libc.abilist |  1 +
> > >  sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist  |  1 +
> > >  sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist  |  1 +
> > >  .../unix/sysv/linux/s390/s390-32/libc.abilist    |  1 +
> > >  .../unix/sysv/linux/s390/s390-64/libc.abilist    |  1 +
> > >  sysdeps/unix/sysv/linux/sh/be/libc.abilist       |  1 +
> > >  sysdeps/unix/sysv/linux/sh/le/libc.abilist       |  1 +
> > >  .../unix/sysv/linux/sparc/sparc32/libc.abilist   |  1 +
> > >  .../unix/sysv/linux/sparc/sparc64/libc.abilist   |  1 +
> > >  sysdeps/unix/sysv/linux/x86_64/64/libc.abilist   |  1 +
> > >  sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist  |  1 +
> > >  sysdeps/x86_64/memcmp.S                          |  2 ++
> > >  sysdeps/x86_64/multiarch/memcmp.c                |  2 ++
> > >  55 files changed, 94 insertions(+)
> > >
> > > diff --git a/string/Versions b/string/Versions
> > > index 298ecd401a..864c4cf7a4 100644
> > > --- a/string/Versions
> > > +++ b/string/Versions
> > > @@ -89,4 +89,7 @@ libc {
> > >      sigdescr_np; sigabbrev_np;
> > >      strerrordesc_np; strerrorname_np;
> > >    }
> > > +  GLIBC_2.35 {
> > > +    __memcmpeq;
> > > +  }
> > >  }
> > > diff --git a/string/memcmp.c b/string/memcmp.c
> > > index 9b46d7a905..5020be00e0 100644
> > > --- a/string/memcmp.c
> > > +++ b/string/memcmp.c
> > > @@ -358,4 +358,6 @@ libc_hidden_builtin_def(memcmp)
> > >  #ifdef weak_alias
> > >  # undef bcmp
> > >  weak_alias (memcmp, bcmp)
> > > +# undef __memcmpeq
> > > +weak_alias (memcmp, __memcmpeq)
> > >  #endif
> > > diff --git a/string/string.h b/string/string.h
> > > index 04e1b7067d..d0b714f836 100644
> > > --- a/string/string.h
> > > +++ b/string/string.h
> > > @@ -64,6 +64,22 @@ extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
> > >  extern int memcmp (const void *__s1, const void *__s2, size_t __n)
> > >       __THROW __attribute_pure__ __nonnull ((1, 2));
> > >
> > > +/* Compare N bytes of S1 and S2.  Return zero if S1 and S2 are equal.
> > > +   Return some non-zero value otherwise.
> > > +
> > > +   Essentially __memcmpeq has the exact same semantics as memcmp
> > > +   except the return value is less constrained.  memcmp is always a
> > > +   correct implementation of __memcmpeq.  As well !!memcmp, -memcmp,
> > > +   or bcmp are correct implementations.
> > > +
> > > +   __memcmpeq is meant to be used by compilers when memcmp return is
> > > +   only used for its bolean value.
> > > +
> > > +   __memcmpeq is declared only for use by compilers.  Programs should
> > > +   continue to use memcmp.  */
> > > +extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n)
> > > +     __THROW __attribute_pure__ __nonnull ((1, 2));
> >
> > Please add an internal one in include/string.h so that it can be called
> > within libc.so bypassing PLT.  Find one place in glibc where __memcmpeq
> > can be used and use it.
>
> Usage outside of a test? It is currently used directly in string/tester.c
>

A standalone test, which can test all IFUNC implementations, is needed.
Noah Goldstein Oct. 21, 2021, 8:01 p.m. UTC | #8
On Thu, Oct 21, 2021 at 2:33 PM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 29/09/2021 12:17, Noah Goldstein via Libc-alpha wrote:
> > No bug.
> >
> > This commit adds support for __memcmpeq() as a new ABI for all
> > targets. In this commit __memcmpeq() is implemented only as an alias
> > to the corresponding targets memcmp() implementation. __memcmpeq() is
> > added as a new symbol starting with GLIBC_2.35 and defined in string.h
> > with comments explaining its behavior. Basic tests that it is callable
> > and works where added in string/tester.c
> >
> > As discussed in the proposal "Add new ABI '__memcmpeq()' to libc"
> > __memcmpeq() is essentially a reserved namespace for bcmp(). The means
> > is shares the same specifications as memcmp() except the return value
> > for non-equal byte sequences is any non-zero value. This is less
> > strict than memcmp()'s return value specification and can be better
> > optimized when a boolean return is all that is needed.
> >
> > __memcmpeq() is meant to only be called by compilers if they can prove
> > that the return value of a memcmp() call is only used for its boolean
> > value.
> >
>
> Should we export memcmpeq() as a GNU extension as well?
>
> > All tests in string/tester.c passed. As well build succeeds on
> > x86_64-linux-gnu target.
>
> This patch requires a NEWS entry for the new symbol and most likely
> a manual entry to describe its semantic.

My understanding is that since we are only exporting this symbol for
compiler use (to optimize boolean use of 'memcmp()') we weren't
planning to add a manual entry.

>
> I also think we should model a new testing based on test-memcmp.c
> to check for multiple alignments and random inputs.

In this patch __memcmpeq is always just memcmp which is tested.

In my followup patch (once this one gets through) to add separate
implementations for x86_64 I add tests. Would it be better to include
those tests in this patchset?
Adhemerval Zanella Oct. 21, 2021, 8:02 p.m. UTC | #9
>>> diff --git a/string/string.h b/string/string.h
>>> index 04e1b7067d..d0b714f836 100644
>>> --- a/string/string.h
>>> +++ b/string/string.h
>>> @@ -64,6 +64,22 @@ extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
>>>  extern int memcmp (const void *__s1, const void *__s2, size_t __n)
>>>       __THROW __attribute_pure__ __nonnull ((1, 2));
>>>
>>> +/* Compare N bytes of S1 and S2.  Return zero if S1 and S2 are equal.
>>> +   Return some non-zero value otherwise.
>>> +
>>> +   Essentially __memcmpeq has the exact same semantics as memcmp
>>> +   except the return value is less constrained.  memcmp is always a
>>> +   correct implementation of __memcmpeq.  As well !!memcmp, -memcmp,
>>> +   or bcmp are correct implementations.
>>> +
>>> +   __memcmpeq is meant to be used by compilers when memcmp return is
>>> +   only used for its bolean value.
>>> +
>>> +   __memcmpeq is declared only for use by compilers.  Programs should
>>> +   continue to use memcmp.  */
>>> +extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n)
>>> +     __THROW __attribute_pure__ __nonnull ((1, 2));
>>
>> Please add an internal one in include/string.h so that it can be called
>> within libc.so bypassing PLT.  Find one place in glibc where __memcmpeq
>> can be used and use it.
> 
> Usage outside of a test? It is currently used directly in string/tester.c


Add a libc_hidden_proto on include/string.h and a libc_hidden_def on
each implementation to create a local alias that bypass PLT if we
eventually need to call it from within glibc.
Adhemerval Zanella Oct. 21, 2021, 8:06 p.m. UTC | #10
On 21/10/2021 17:01, Noah Goldstein wrote:
> On Thu, Oct 21, 2021 at 2:33 PM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>>
>>
>> On 29/09/2021 12:17, Noah Goldstein via Libc-alpha wrote:
>>> No bug.
>>>
>>> This commit adds support for __memcmpeq() as a new ABI for all
>>> targets. In this commit __memcmpeq() is implemented only as an alias
>>> to the corresponding targets memcmp() implementation. __memcmpeq() is
>>> added as a new symbol starting with GLIBC_2.35 and defined in string.h
>>> with comments explaining its behavior. Basic tests that it is callable
>>> and works where added in string/tester.c
>>>
>>> As discussed in the proposal "Add new ABI '__memcmpeq()' to libc"
>>> __memcmpeq() is essentially a reserved namespace for bcmp(). The means
>>> is shares the same specifications as memcmp() except the return value
>>> for non-equal byte sequences is any non-zero value. This is less
>>> strict than memcmp()'s return value specification and can be better
>>> optimized when a boolean return is all that is needed.
>>>
>>> __memcmpeq() is meant to only be called by compilers if they can prove
>>> that the return value of a memcmp() call is only used for its boolean
>>> value.
>>>
>>
>> Should we export memcmpeq() as a GNU extension as well?
>>
>>> All tests in string/tester.c passed. As well build succeeds on
>>> x86_64-linux-gnu target.
>>
>> This patch requires a NEWS entry for the new symbol and most likely
>> a manual entry to describe its semantic.
> 
> My understanding is that since we are only exporting this symbol for
> compiler use (to optimize boolean use of 'memcmp()') we weren't
> planning to add a manual entry.

But you are exporting the double underscore symbol on an installed
header, so it would be visible to users as well.

I wonder if it would be better to only export 'memcmpeq' as a
GNU extension on string.h and '__memcmpeq' as a global symbol
without a prototype (so only compiler generated objects will have
bindings to '__memcmpeq').

> 
>>
>> I also think we should model a new testing based on test-memcmp.c
>> to check for multiple alignments and random inputs.
> 
> In this patch __memcmpeq is always just memcmp which is tested.
> 
> In my followup patch (once this one gets through) to add separate
> implementations for x86_64 I add tests. Would it be better to include
> those tests in this patchset?
> 

Right, in this patch or in subsequent patch is fine.
H.J. Lu Oct. 21, 2021, 8:07 p.m. UTC | #11
On Thu, Oct 21, 2021 at 1:02 PM Noah Goldstein via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> On Thu, Oct 21, 2021 at 2:33 PM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
> >
> >
> >
> > On 29/09/2021 12:17, Noah Goldstein via Libc-alpha wrote:
> > > No bug.
> > >
> > > This commit adds support for __memcmpeq() as a new ABI for all
> > > targets. In this commit __memcmpeq() is implemented only as an alias
> > > to the corresponding targets memcmp() implementation. __memcmpeq() is
> > > added as a new symbol starting with GLIBC_2.35 and defined in string.h
> > > with comments explaining its behavior. Basic tests that it is callable
> > > and works where added in string/tester.c
> > >
> > > As discussed in the proposal "Add new ABI '__memcmpeq()' to libc"
> > > __memcmpeq() is essentially a reserved namespace for bcmp(). The means
> > > is shares the same specifications as memcmp() except the return value
> > > for non-equal byte sequences is any non-zero value. This is less
> > > strict than memcmp()'s return value specification and can be better
> > > optimized when a boolean return is all that is needed.
> > >
> > > __memcmpeq() is meant to only be called by compilers if they can prove
> > > that the return value of a memcmp() call is only used for its boolean
> > > value.
> > >
> >
> > Should we export memcmpeq() as a GNU extension as well?
> >
> > > All tests in string/tester.c passed. As well build succeeds on
> > > x86_64-linux-gnu target.
> >
> > This patch requires a NEWS entry for the new symbol and most likely
> > a manual entry to describe its semantic.
>
> My understanding is that since we are only exporting this symbol for
> compiler use (to optimize boolean use of 'memcmp()') we weren't
> planning to add a manual entry.
>
> >
> > I also think we should model a new testing based on test-memcmp.c
> > to check for multiple alignments and random inputs.
>
> In this patch __memcmpeq is always just memcmp which is tested.
>
> In my followup patch (once this one gets through) to add separate
> implementations for x86_64 I add tests. Would it be better to include
> those tests in this patchset?

I think we should add it now since someone can add IFUNC for
a non x86-64 target before x86-64 one is landed.

With __memcmpeq, bcmp should be an alias of __memcmpeq,
not memcmp.

--
H.J.
Noah Goldstein Oct. 21, 2021, 8:11 p.m. UTC | #12
On Thu, Oct 21, 2021 at 3:07 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, Oct 21, 2021 at 1:02 PM Noah Goldstein via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
> >
> > On Thu, Oct 21, 2021 at 2:33 PM Adhemerval Zanella
> > <adhemerval.zanella@linaro.org> wrote:
> > >
> > >
> > >
> > > On 29/09/2021 12:17, Noah Goldstein via Libc-alpha wrote:
> > > > No bug.
> > > >
> > > > This commit adds support for __memcmpeq() as a new ABI for all
> > > > targets. In this commit __memcmpeq() is implemented only as an alias
> > > > to the corresponding targets memcmp() implementation. __memcmpeq() is
> > > > added as a new symbol starting with GLIBC_2.35 and defined in string.h
> > > > with comments explaining its behavior. Basic tests that it is callable
> > > > and works where added in string/tester.c
> > > >
> > > > As discussed in the proposal "Add new ABI '__memcmpeq()' to libc"
> > > > __memcmpeq() is essentially a reserved namespace for bcmp(). The means
> > > > is shares the same specifications as memcmp() except the return value
> > > > for non-equal byte sequences is any non-zero value. This is less
> > > > strict than memcmp()'s return value specification and can be better
> > > > optimized when a boolean return is all that is needed.
> > > >
> > > > __memcmpeq() is meant to only be called by compilers if they can prove
> > > > that the return value of a memcmp() call is only used for its boolean
> > > > value.
> > > >
> > >
> > > Should we export memcmpeq() as a GNU extension as well?
> > >
> > > > All tests in string/tester.c passed. As well build succeeds on
> > > > x86_64-linux-gnu target.
> > >
> > > This patch requires a NEWS entry for the new symbol and most likely
> > > a manual entry to describe its semantic.
> >
> > My understanding is that since we are only exporting this symbol for
> > compiler use (to optimize boolean use of 'memcmp()') we weren't
> > planning to add a manual entry.
> >
> > >
> > > I also think we should model a new testing based on test-memcmp.c
> > > to check for multiple alignments and random inputs.
> >
> > In this patch __memcmpeq is always just memcmp which is tested.
> >
> > In my followup patch (once this one gets through) to add separate
> > implementations for x86_64 I add tests. Would it be better to include
> > those tests in this patchset?
>
> I think we should add it now since someone can add IFUNC for
> a non x86-64 target before x86-64 one is landed.

Got it.

>
> With __memcmpeq, bcmp should be an alias of __memcmpeq,
> not memcmp.

I think we had some concerns that since 'bcmp' had aliased 'memcmp'
for so long users may have started relying on the -/+/= behavior.

>
> --
> H.J.
Noah Goldstein Oct. 21, 2021, 8:23 p.m. UTC | #13
On Thu, Oct 21, 2021 at 3:02 PM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> >>> diff --git a/string/string.h b/string/string.h
> >>> index 04e1b7067d..d0b714f836 100644
> >>> --- a/string/string.h
> >>> +++ b/string/string.h
> >>> @@ -64,6 +64,22 @@ extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
> >>>  extern int memcmp (const void *__s1, const void *__s2, size_t __n)
> >>>       __THROW __attribute_pure__ __nonnull ((1, 2));
> >>>
> >>> +/* Compare N bytes of S1 and S2.  Return zero if S1 and S2 are equal.
> >>> +   Return some non-zero value otherwise.
> >>> +
> >>> +   Essentially __memcmpeq has the exact same semantics as memcmp
> >>> +   except the return value is less constrained.  memcmp is always a
> >>> +   correct implementation of __memcmpeq.  As well !!memcmp, -memcmp,
> >>> +   or bcmp are correct implementations.
> >>> +
> >>> +   __memcmpeq is meant to be used by compilers when memcmp return is
> >>> +   only used for its bolean value.
> >>> +
> >>> +   __memcmpeq is declared only for use by compilers.  Programs should
> >>> +   continue to use memcmp.  */
> >>> +extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n)
> >>> +     __THROW __attribute_pure__ __nonnull ((1, 2));
> >>
> >> Please add an internal one in include/string.h so that it can be called
> >> within libc.so bypassing PLT.  Find one place in glibc where __memcmpeq
> >> can be used and use it.
> >
> > Usage outside of a test? It is currently used directly in string/tester.c
>
>
> Add a libc_hidden_proto on include/string.h and a libc_hidden_def on
> each implementation to create a local alias that bypass PLT if we
> eventually need to call it from within glibc.

Does each place this patch does 'weak_alias(memcmp, __memcmpeq)`
need a 'libc_hidden_def' for '__memcmpeq'?
>
Adhemerval Zanella Oct. 21, 2021, 8:26 p.m. UTC | #14
On 21/10/2021 17:23, Noah Goldstein wrote:
> On Thu, Oct 21, 2021 at 3:02 PM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>>>>> diff --git a/string/string.h b/string/string.h
>>>>> index 04e1b7067d..d0b714f836 100644
>>>>> --- a/string/string.h
>>>>> +++ b/string/string.h
>>>>> @@ -64,6 +64,22 @@ extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
>>>>>  extern int memcmp (const void *__s1, const void *__s2, size_t __n)
>>>>>       __THROW __attribute_pure__ __nonnull ((1, 2));
>>>>>
>>>>> +/* Compare N bytes of S1 and S2.  Return zero if S1 and S2 are equal.
>>>>> +   Return some non-zero value otherwise.
>>>>> +
>>>>> +   Essentially __memcmpeq has the exact same semantics as memcmp
>>>>> +   except the return value is less constrained.  memcmp is always a
>>>>> +   correct implementation of __memcmpeq.  As well !!memcmp, -memcmp,
>>>>> +   or bcmp are correct implementations.
>>>>> +
>>>>> +   __memcmpeq is meant to be used by compilers when memcmp return is
>>>>> +   only used for its bolean value.
>>>>> +
>>>>> +   __memcmpeq is declared only for use by compilers.  Programs should
>>>>> +   continue to use memcmp.  */
>>>>> +extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n)
>>>>> +     __THROW __attribute_pure__ __nonnull ((1, 2));
>>>>
>>>> Please add an internal one in include/string.h so that it can be called
>>>> within libc.so bypassing PLT.  Find one place in glibc where __memcmpeq
>>>> can be used and use it.
>>>
>>> Usage outside of a test? It is currently used directly in string/tester.c
>>
>>
>> Add a libc_hidden_proto on include/string.h and a libc_hidden_def on
>> each implementation to create a local alias that bypass PLT if we
>> eventually need to call it from within glibc.
> 
> Does each place this patch does 'weak_alias(memcmp, __memcmpeq)`
> need a 'libc_hidden_def' for '__memcmpeq'?

Yes, it might not generate regression, but it will once we start to call
__memcmpeq internally (which compiler might generate eventually).
Noah Goldstein Oct. 21, 2021, 9:04 p.m. UTC | #15
On Thu, Oct 21, 2021 at 3:01 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, Oct 21, 2021 at 12:58 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> >
> > On Thu, Oct 21, 2021 at 2:28 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Wed, Sep 29, 2021 at 10:17:43AM -0500, GNU C Library wrote:
> > > > No bug.
> > > >
> > > > This commit adds support for __memcmpeq() as a new ABI for all
> > > > targets. In this commit __memcmpeq() is implemented only as an alias
> > > > to the corresponding targets memcmp() implementation. __memcmpeq() is
> > > > added as a new symbol starting with GLIBC_2.35 and defined in string.h
> > > > with comments explaining its behavior. Basic tests that it is callable
> > > > and works where added in string/tester.c
> > > >
> > > > As discussed in the proposal "Add new ABI '__memcmpeq()' to libc"
> > > > __memcmpeq() is essentially a reserved namespace for bcmp(). The means
> > > > is shares the same specifications as memcmp() except the return value
> > > > for non-equal byte sequences is any non-zero value. This is less
> > > > strict than memcmp()'s return value specification and can be better
> > > > optimized when a boolean return is all that is needed.
> > > >
> > > > __memcmpeq() is meant to only be called by compilers if they can prove
> > > > that the return value of a memcmp() call is only used for its boolean
> > > > value.
> > > >
> > > > All tests in string/tester.c passed. As well build succeeds on
> > > > x86_64-linux-gnu target.
> > > > ---
> > > >  string/Versions                                  |  3 +++
> > > >  string/memcmp.c                                  |  2 ++
> > > >  string/string.h                                  | 16 ++++++++++++++++
> > > >  string/tester.c                                  | 16 ++++++++++++++++
> > > >  sysdeps/aarch64/memcmp.S                         |  2 ++
> > > >  sysdeps/csky/abiv2/memcmp.S                      |  1 +
> > > >  sysdeps/i386/i686/memcmp.S                       |  2 ++
> > > >  sysdeps/i386/i686/multiarch/memcmp.c             |  1 +
> > > >  sysdeps/i386/memcmp.S                            |  2 ++
> > > >  sysdeps/ia64/memcmp.S                            |  1 +
> > > >  sysdeps/mach/hurd/i386/libc.abilist              |  1 +
> > > >  sysdeps/powerpc/powerpc32/405/memcmp.S           |  1 +
> > > >  sysdeps/powerpc/powerpc32/power4/memcmp.S        |  1 +
> > > >  sysdeps/powerpc/powerpc32/power7/memcmp.S        |  1 +
> > > >  sysdeps/powerpc/powerpc64/le/power10/memcmp.S    |  1 +
> > > >  sysdeps/powerpc/powerpc64/power4/memcmp.S        |  1 +
> > > >  sysdeps/powerpc/powerpc64/power7/memcmp.S        |  1 +
> > > >  sysdeps/powerpc/powerpc64/power8/memcmp.S        |  1 +
> > > >  sysdeps/s390/memcmp-z900.S                       |  1 +
> > > >  sysdeps/s390/memcmp.c                            |  1 +
> > > >  sysdeps/sparc/sparc64/memcmp.S                   |  2 ++
> > > >  sysdeps/unix/sysv/linux/aarch64/libc.abilist     |  1 +
> > > >  sysdeps/unix/sysv/linux/alpha/libc.abilist       |  1 +
> > > >  sysdeps/unix/sysv/linux/arc/libc.abilist         |  1 +
> > > >  sysdeps/unix/sysv/linux/arm/be/libc.abilist      |  1 +
> > > >  sysdeps/unix/sysv/linux/arm/le/libc.abilist      |  1 +
> > > >  sysdeps/unix/sysv/linux/csky/libc.abilist        |  1 +
> > > >  sysdeps/unix/sysv/linux/hppa/libc.abilist        |  1 +
> > > >  sysdeps/unix/sysv/linux/i386/libc.abilist        |  1 +
> > > >  sysdeps/unix/sysv/linux/ia64/libc.abilist        |  1 +
> > > >  .../unix/sysv/linux/m68k/coldfire/libc.abilist   |  1 +
> > > >  sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist |  1 +
> > > >  .../unix/sysv/linux/microblaze/be/libc.abilist   |  1 +
> > > >  .../unix/sysv/linux/microblaze/le/libc.abilist   |  1 +
> > > >  .../unix/sysv/linux/mips/mips32/fpu/libc.abilist |  1 +
> > > >  .../sysv/linux/mips/mips32/nofpu/libc.abilist    |  1 +
> > > >  .../unix/sysv/linux/mips/mips64/n32/libc.abilist |  1 +
> > > >  .../unix/sysv/linux/mips/mips64/n64/libc.abilist |  1 +
> > > >  sysdeps/unix/sysv/linux/nios2/libc.abilist       |  1 +
> > > >  .../linux/powerpc/powerpc32/fpu/libc.abilist     |  1 +
> > > >  .../linux/powerpc/powerpc32/nofpu/libc.abilist   |  1 +
> > > >  .../sysv/linux/powerpc/powerpc64/be/libc.abilist |  1 +
> > > >  .../sysv/linux/powerpc/powerpc64/le/libc.abilist |  1 +
> > > >  sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist  |  1 +
> > > >  sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist  |  1 +
> > > >  .../unix/sysv/linux/s390/s390-32/libc.abilist    |  1 +
> > > >  .../unix/sysv/linux/s390/s390-64/libc.abilist    |  1 +
> > > >  sysdeps/unix/sysv/linux/sh/be/libc.abilist       |  1 +
> > > >  sysdeps/unix/sysv/linux/sh/le/libc.abilist       |  1 +
> > > >  .../unix/sysv/linux/sparc/sparc32/libc.abilist   |  1 +
> > > >  .../unix/sysv/linux/sparc/sparc64/libc.abilist   |  1 +
> > > >  sysdeps/unix/sysv/linux/x86_64/64/libc.abilist   |  1 +
> > > >  sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist  |  1 +
> > > >  sysdeps/x86_64/memcmp.S                          |  2 ++
> > > >  sysdeps/x86_64/multiarch/memcmp.c                |  2 ++
> > > >  55 files changed, 94 insertions(+)
> > > >
> > > > diff --git a/string/Versions b/string/Versions
> > > > index 298ecd401a..864c4cf7a4 100644
> > > > --- a/string/Versions
> > > > +++ b/string/Versions
> > > > @@ -89,4 +89,7 @@ libc {
> > > >      sigdescr_np; sigabbrev_np;
> > > >      strerrordesc_np; strerrorname_np;
> > > >    }
> > > > +  GLIBC_2.35 {
> > > > +    __memcmpeq;
> > > > +  }
> > > >  }
> > > > diff --git a/string/memcmp.c b/string/memcmp.c
> > > > index 9b46d7a905..5020be00e0 100644
> > > > --- a/string/memcmp.c
> > > > +++ b/string/memcmp.c
> > > > @@ -358,4 +358,6 @@ libc_hidden_builtin_def(memcmp)
> > > >  #ifdef weak_alias
> > > >  # undef bcmp
> > > >  weak_alias (memcmp, bcmp)
> > > > +# undef __memcmpeq
> > > > +weak_alias (memcmp, __memcmpeq)
> > > >  #endif
> > > > diff --git a/string/string.h b/string/string.h
> > > > index 04e1b7067d..d0b714f836 100644
> > > > --- a/string/string.h
> > > > +++ b/string/string.h
> > > > @@ -64,6 +64,22 @@ extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
> > > >  extern int memcmp (const void *__s1, const void *__s2, size_t __n)
> > > >       __THROW __attribute_pure__ __nonnull ((1, 2));
> > > >
> > > > +/* Compare N bytes of S1 and S2.  Return zero if S1 and S2 are equal.
> > > > +   Return some non-zero value otherwise.
> > > > +
> > > > +   Essentially __memcmpeq has the exact same semantics as memcmp
> > > > +   except the return value is less constrained.  memcmp is always a
> > > > +   correct implementation of __memcmpeq.  As well !!memcmp, -memcmp,
> > > > +   or bcmp are correct implementations.
> > > > +
> > > > +   __memcmpeq is meant to be used by compilers when memcmp return is
> > > > +   only used for its bolean value.
> > > > +
> > > > +   __memcmpeq is declared only for use by compilers.  Programs should
> > > > +   continue to use memcmp.  */
> > > > +extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n)
> > > > +     __THROW __attribute_pure__ __nonnull ((1, 2));
> > >
> > > Please add an internal one in include/string.h so that it can be called
> > > within libc.so bypassing PLT.  Find one place in glibc where __memcmpeq
> > > can be used and use it.
> >
> > Usage outside of a test? It is currently used directly in string/tester.c
> >
>
> A standalone test, which can test all IFUNC implementations, is needed.

I added a test-memcmpeq.c file but it doesn't go through all the ifunc versions
available. I.e on x86_64 the output of test-memcmpeq.out is:

```
                        __memcmpeq simple_memcmp
```

whereas test-memcmp.out is:

```
                        simple_memcmp __memcmp_avx2_movbe
__memcmp_evex_movbe __memcmp_sse4_1 __memcmp_ssse3 __memcmp_sse2
```

Is there something else I need to be adding in addition to the
weak_alias / hidden def to run all of the ifunc variations?

>
> --
> H.J.
Florian Weimer Oct. 21, 2021, 9:18 p.m. UTC | #16
* Adhemerval Zanella via Libc-alpha:

> On 21/10/2021 17:01, Noah Goldstein wrote:
>> My understanding is that since we are only exporting this symbol for
>> compiler use (to optimize boolean use of 'memcmp()') we weren't
>> planning to add a manual entry.
>
> But you are exporting the double underscore symbol on an installed
> header, so it would be visible to users as well.

The advantage of exporting it is that GCC can perform the memcmp →
__memcmpeq if and only if a suitable declaration of __memcmpeq is in
scope.

Maybe we could add #pragma GCC poison for __memcmpeq.  Or add a new
pragma to enable the transformation.

Thanks,
Florian
diff mbox series

Patch

diff --git a/string/Versions b/string/Versions
index 298ecd401a..864c4cf7a4 100644
--- a/string/Versions
+++ b/string/Versions
@@ -89,4 +89,7 @@  libc {
     sigdescr_np; sigabbrev_np;
     strerrordesc_np; strerrorname_np;
   }
+  GLIBC_2.35 {
+    __memcmpeq;
+  }
 }
diff --git a/string/memcmp.c b/string/memcmp.c
index 9b46d7a905..5020be00e0 100644
--- a/string/memcmp.c
+++ b/string/memcmp.c
@@ -358,4 +358,6 @@  libc_hidden_builtin_def(memcmp)
 #ifdef weak_alias
 # undef bcmp
 weak_alias (memcmp, bcmp)
+# undef __memcmpeq
+weak_alias (memcmp, __memcmpeq)
 #endif
diff --git a/string/string.h b/string/string.h
index 04e1b7067d..d0b714f836 100644
--- a/string/string.h
+++ b/string/string.h
@@ -64,6 +64,22 @@  extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
 extern int memcmp (const void *__s1, const void *__s2, size_t __n)
      __THROW __attribute_pure__ __nonnull ((1, 2));
 
+/* Compare N bytes of S1 and S2.  Return zero if S1 and S2 are equal.
+   Return some non-zero value otherwise.
+
+   Essentially __memcmpeq has the exact same semantics as memcmp
+   except the return value is less constrained.  memcmp is always a
+   correct implementation of __memcmpeq.  As well !!memcmp, -memcmp,
+   or bcmp are correct implementations.
+
+   __memcmpeq is meant to be used by compilers when memcmp return is
+   only used for its bolean value.
+
+   __memcmpeq is declared only for use by compilers.  Programs should
+   continue to use memcmp.  */
+extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n)
+     __THROW __attribute_pure__ __nonnull ((1, 2));
+
 /* Search N bytes of S for C.  */
 #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
 extern "C++"
diff --git a/string/tester.c b/string/tester.c
index 778160ae6e..605b3f00f9 100644
--- a/string/tester.c
+++ b/string/tester.c
@@ -1449,6 +1449,19 @@  test_bcmp (void)
   check(bcmp("abc", "def", 0) == 0, 8);	/* Zero count. */
 }
 
+static void
+test_memcmpeq (void)
+{
+  it = "__memcmpeq";
+  check (__memcmpeq ("a", "a", 1) == 0, 1); /* Identity.  */
+  check (__memcmpeq ("abc", "abc", 3) == 0, 2); /* Multicharacter.  */
+  check (__memcmpeq ("abcd", "abce", 4) != 0, 3); /* Honestly unequal.  */
+  check (__memcmpeq ("abce", "abcd", 4) != 0, 4);
+  check (__memcmpeq ("alph", "beta", 4) != 0, 5);
+  check (__memcmpeq ("abce", "abcd", 3) == 0, 6); /* Count limited.  */
+  check (__memcmpeq ("abc", "def", 0) == 0, 8); /* Zero count.  */
+}
+
 static void
 test_strerror (void)
 {
@@ -1611,6 +1624,9 @@  main (void)
   /* bcmp - somewhat like memcmp.  */
   test_bcmp ();
 
+  /* __memcmpeq - somewhat like memcmp.  */
+  test_memcmpeq ();
+
   /* strndup.  */
   test_strndup ();
 
diff --git a/sysdeps/aarch64/memcmp.S b/sysdeps/aarch64/memcmp.S
index c1937f6f5c..bc932eff2a 100644
--- a/sysdeps/aarch64/memcmp.S
+++ b/sysdeps/aarch64/memcmp.S
@@ -177,4 +177,6 @@  L(ret_0):
 END (memcmp)
 #undef bcmp
 weak_alias (memcmp, bcmp)
+#undef __memcmpeq
+weak_alias (memcmp, __memcmpeq)
 libc_hidden_builtin_def (memcmp)
diff --git a/sysdeps/csky/abiv2/memcmp.S b/sysdeps/csky/abiv2/memcmp.S
index 1560387618..d61fca0f29 100644
--- a/sysdeps/csky/abiv2/memcmp.S
+++ b/sysdeps/csky/abiv2/memcmp.S
@@ -138,5 +138,6 @@  ENTRY (memcmp)
 	br	.L_s1_aligned
 END (memcmp)
 weak_alias (memcmp, bcmp)
+weak_alias (memcmp, __memcmpeq)
 libc_hidden_def (memcmp)
 .weak memcmp
diff --git a/sysdeps/i386/i686/memcmp.S b/sysdeps/i386/i686/memcmp.S
index b26b124fad..0194f8deab 100644
--- a/sysdeps/i386/i686/memcmp.S
+++ b/sysdeps/i386/i686/memcmp.S
@@ -405,4 +405,6 @@  L(table_32bytes) :
 
 #undef bcmp
 weak_alias (memcmp, bcmp)
+#undef __memcmpeq
+weak_alias (memcmp, __memcmpeq)
 libc_hidden_builtin_def (memcmp)
diff --git a/sysdeps/i386/i686/multiarch/memcmp.c b/sysdeps/i386/i686/multiarch/memcmp.c
index 6e058a8857..956fc8e601 100644
--- a/sysdeps/i386/i686/multiarch/memcmp.c
+++ b/sysdeps/i386/i686/multiarch/memcmp.c
@@ -29,4 +29,5 @@ 
 libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR ());
 
 weak_alias (memcmp, bcmp)
+weak_alias (memcmp, __memcmpeq)
 #endif
diff --git a/sysdeps/i386/memcmp.S b/sysdeps/i386/memcmp.S
index 1f212b0f6d..18e225f963 100644
--- a/sysdeps/i386/memcmp.S
+++ b/sysdeps/i386/memcmp.S
@@ -70,4 +70,6 @@  END (memcmp)
 
 #undef bcmp
 weak_alias (memcmp, bcmp)
+#undef __memcmpeq
+weak_alias (memcmp, __memcmpeq)
 libc_hidden_builtin_def (memcmp)
diff --git a/sysdeps/ia64/memcmp.S b/sysdeps/ia64/memcmp.S
index 97539c23fd..4488e0eba4 100644
--- a/sysdeps/ia64/memcmp.S
+++ b/sysdeps/ia64/memcmp.S
@@ -160,4 +160,5 @@  ENTRY(memcmp)
 END(memcmp)
 
 weak_alias (memcmp, bcmp)
+weak_alias (memcmp, __memcmpeq)
 libc_hidden_builtin_def (memcmp)
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index c5da10a0cd..e849d6fa35 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -2285,6 +2285,7 @@  GLIBC_2.34 res_send F
 GLIBC_2.34 shm_open F
 GLIBC_2.34 shm_unlink F
 GLIBC_2.34 timespec_getres F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/powerpc/powerpc32/405/memcmp.S b/sysdeps/powerpc/powerpc32/405/memcmp.S
index 6a6a54d90f..e8b1b6c9bd 100644
--- a/sysdeps/powerpc/powerpc32/405/memcmp.S
+++ b/sysdeps/powerpc/powerpc32/405/memcmp.S
@@ -126,3 +126,4 @@  L(st2):
 END (memcmp)
 libc_hidden_builtin_def (memcmp)
 weak_alias (memcmp,bcmp)
+weak_alias (memcmp, __memcmpeq)
diff --git a/sysdeps/powerpc/powerpc32/power4/memcmp.S b/sysdeps/powerpc/powerpc32/power4/memcmp.S
index 814d2f211d..e4dde875bb 100644
--- a/sysdeps/powerpc/powerpc32/power4/memcmp.S
+++ b/sysdeps/powerpc/powerpc32/power4/memcmp.S
@@ -1373,3 +1373,4 @@  END (memcmp)
 
 libc_hidden_builtin_def (memcmp)
 weak_alias (memcmp, bcmp)
+weak_alias (memcmp, __memcmpeq)
diff --git a/sysdeps/powerpc/powerpc32/power7/memcmp.S b/sysdeps/powerpc/powerpc32/power7/memcmp.S
index 8a19953e2d..e60a62fc86 100644
--- a/sysdeps/powerpc/powerpc32/power7/memcmp.S
+++ b/sysdeps/powerpc/powerpc32/power7/memcmp.S
@@ -1373,3 +1373,4 @@  END (memcmp)
 
 libc_hidden_builtin_def (memcmp)
 weak_alias (memcmp, bcmp)
+weak_alias (memcmp, __memcmpeq)
diff --git a/sysdeps/powerpc/powerpc64/le/power10/memcmp.S b/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
index 52f244e7e7..c7fe8047ca 100644
--- a/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
+++ b/sysdeps/powerpc/powerpc64/le/power10/memcmp.S
@@ -177,3 +177,4 @@  L(tail8):
 END (MEMCMP)
 libc_hidden_builtin_def (memcmp)
 weak_alias (memcmp, bcmp)
+weak_alias (memcmp, __memcmpeq)
diff --git a/sysdeps/powerpc/powerpc64/power4/memcmp.S b/sysdeps/powerpc/powerpc64/power4/memcmp.S
index dc1be3a0d8..4ab4a90496 100644
--- a/sysdeps/powerpc/powerpc64/power4/memcmp.S
+++ b/sysdeps/powerpc/powerpc64/power4/memcmp.S
@@ -1374,3 +1374,4 @@  L(duzeroLength):
 END (MEMCMP)
 libc_hidden_builtin_def (memcmp)
 weak_alias (memcmp, bcmp)
+weak_alias (memcmp, __memcmpeq)
diff --git a/sysdeps/powerpc/powerpc64/power7/memcmp.S b/sysdeps/powerpc/powerpc64/power7/memcmp.S
index bc034a55bc..b541978b5f 100644
--- a/sysdeps/powerpc/powerpc64/power7/memcmp.S
+++ b/sysdeps/powerpc/powerpc64/power7/memcmp.S
@@ -1059,3 +1059,4 @@  L(duzeroLength):
 END (MEMCMP)
 libc_hidden_builtin_def (memcmp)
 weak_alias (memcmp, bcmp)
+weak_alias (memcmp, __memcmpeq)
diff --git a/sysdeps/powerpc/powerpc64/power8/memcmp.S b/sysdeps/powerpc/powerpc64/power8/memcmp.S
index b676b09a9b..d4f84a5b6f 100644
--- a/sysdeps/powerpc/powerpc64/power8/memcmp.S
+++ b/sysdeps/powerpc/powerpc64/power8/memcmp.S
@@ -1442,3 +1442,4 @@  L(duzeroLength):
 END (MEMCMP)
 libc_hidden_builtin_def (memcmp)
 weak_alias (memcmp, bcmp)
+weak_alias (memcmp, __memcmpeq)
diff --git a/sysdeps/s390/memcmp-z900.S b/sysdeps/s390/memcmp-z900.S
index 995d52e47d..0942d32814 100644
--- a/sysdeps/s390/memcmp-z900.S
+++ b/sysdeps/s390/memcmp-z900.S
@@ -164,6 +164,7 @@  END(MEMCMP_Z196)
    Otherwise see sysdeps/s390/memcmp.c.  */
 strong_alias (MEMCMP_DEFAULT, memcmp)
 weak_alias (memcmp, bcmp)
+weak_alias (memcmp, __memcmpeq)
 #endif
 
 #if defined SHARED && IS_IN (libc)
diff --git a/sysdeps/s390/memcmp.c b/sysdeps/s390/memcmp.c
index 0b4e9da717..475fc45d3a 100644
--- a/sysdeps/s390/memcmp.c
+++ b/sysdeps/s390/memcmp.c
@@ -46,4 +46,5 @@  s390_libc_ifunc_expr (__redirect_memcmp, memcmp,
 		      })
 		      )
 weak_alias (memcmp, bcmp);
+weak_alias (memcmp, __memcmpeq)
 #endif
diff --git a/sysdeps/sparc/sparc64/memcmp.S b/sysdeps/sparc/sparc64/memcmp.S
index d8d9ff9b24..edcc19915a 100644
--- a/sysdeps/sparc/sparc64/memcmp.S
+++ b/sysdeps/sparc/sparc64/memcmp.S
@@ -137,4 +137,6 @@  END(memcmp)
 
 #undef bcmp
 weak_alias (memcmp, bcmp)
+#undef __memcmpeq
+weak_alias (memcmp, __memcmpeq)
 libc_hidden_builtin_def (memcmp)
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index 21a2e50a88..f227ae6cee 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -2612,3 +2612,4 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index a201fd69ba..0ccc3fc73e 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2709,6 +2709,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
index 2611436937..fd80704787 100644
--- a/sysdeps/unix/sysv/linux/arc/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
@@ -2373,3 +2373,4 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
index a426241965..2ae6c58b8a 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
@@ -491,6 +491,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
 GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
index 02f80418cc..fcfd1e8594 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
@@ -488,6 +488,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
 GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index b7676eb372..ba034b8541 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -2647,3 +2647,4 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index f6965c9d95..b7460bec8a 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -2596,6 +2596,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 2e7603d9ed..a4dc341ded 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -2780,6 +2780,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index dd3a56d3fe..94b222dbc7 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -2547,6 +2547,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index c1e0ea9c10..12fd3b6310 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -492,6 +492,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0x98
 GLIBC_2.4 _IO_2_1_stdin_ D 0x98
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 93161048ca..4d2296007a 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -2723,6 +2723,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
index 0aaeec8a27..a223278a3d 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
@@ -2696,3 +2696,4 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
index bec5f456c9..780a4f5b0b 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
@@ -2693,3 +2693,4 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index 97d2127f78..cd65136062 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -2688,6 +2688,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index acb0756c11..b5b9902db5 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -2686,6 +2686,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index ebc21dde1e..57593d5f94 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -2694,6 +2694,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index c68f7e3c6c..e944d76bed 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -2598,6 +2598,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index e5b6834f14..8af5a3a90d 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -2735,3 +2735,4 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 132707c8ad..3a0213b39f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -2750,6 +2750,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index 0af2be31a0..f57df0234b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -2783,6 +2783,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index cf864632d0..259a0cfc51 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -2506,6 +2506,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index d566d675d0..126541daf1 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2808,3 +2808,4 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
index c9a7eacb32..05df4d13d2 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
@@ -2375,3 +2375,4 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index 8299131cb2..8e349cbff8 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -2575,3 +2575,4 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index c3fe78f77f..e9de402766 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2748,6 +2748,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index 83e542aa8c..1a010c745d 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -2543,6 +2543,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
index dc502f6833..22ce530975 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
@@ -2603,6 +2603,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
index cba1abb556..960df07b83 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
@@ -2600,6 +2600,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index d4a516fb47..eedb376f3d 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -2743,6 +2743,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index 6268875ba3..86e0c92bef 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -2570,6 +2570,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 095e914b73..5e59d90623 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -2521,6 +2521,7 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index dd910f7fe9..94412dc134 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -2627,3 +2627,4 @@  GLIBC_2.34 tss_create F
 GLIBC_2.34 tss_delete F
 GLIBC_2.34 tss_get F
 GLIBC_2.34 tss_set F
+GLIBC_2.35 __memcmpeq F
diff --git a/sysdeps/x86_64/memcmp.S b/sysdeps/x86_64/memcmp.S
index 870e15c5a0..f41ae48006 100644
--- a/sysdeps/x86_64/memcmp.S
+++ b/sysdeps/x86_64/memcmp.S
@@ -358,4 +358,6 @@  END(memcmp)
 
 #undef bcmp
 weak_alias (memcmp, bcmp)
+#undef __memcmpeq
+weak_alias (memcmp, __memcmpeq)
 libc_hidden_builtin_def (memcmp)
diff --git a/sysdeps/x86_64/multiarch/memcmp.c b/sysdeps/x86_64/multiarch/memcmp.c
index fe725f3563..fe125e0904 100644
--- a/sysdeps/x86_64/multiarch/memcmp.c
+++ b/sysdeps/x86_64/multiarch/memcmp.c
@@ -29,6 +29,8 @@ 
 libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR ());
 # undef bcmp
 weak_alias (memcmp, bcmp)
+# undef __memcmpeq
+weak_alias (memcmp, __memcmpeq)
 
 # ifdef SHARED
 __hidden_ver1 (memcmp, __GI_memcmp, __redirect_memcmp)