mirror of
https://sourceware.org/git/glibc.git
synced 2025-10-24 13:33:08 +03:00
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.
38 lines
1.4 KiB
C
38 lines
1.4 KiB
C
/* Copyright (C) 2013-2021 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, see
|
|
<https://www.gnu.org/licenses/>. */
|
|
|
|
#include <string.h>
|
|
|
|
#define MEMCMP __memcmp_ppc
|
|
#undef weak_alias
|
|
#define weak_alias(name, aliasname) \
|
|
extern __typeof (__memcmp_ppc) aliasname \
|
|
__attribute__ ((weak, alias ("__memcmp_ppc")));
|
|
#undef strong_alias
|
|
#define strong_alias(name, aliasname) \
|
|
extern __typeof (__memcmp_ppc) aliasname \
|
|
__attribute__ ((alias ("__memcmp_ppc")));
|
|
#if IS_IN (libc) && defined(SHARED)
|
|
# undef libc_hidden_builtin_def
|
|
# define libc_hidden_builtin_def(name) \
|
|
__hidden_ver1(__memcmp_ppc, __GI_memcmp, __memcmp_ppc);
|
|
#endif
|
|
|
|
extern __typeof (memcmp) __memcmp_ppc attribute_hidden;
|
|
|
|
#include <string/memcmp.c>
|