[PATCH] x86-64: Make bcmp an alias of __memcmpeq

H.J. Lu hjl.tools@gmail.com
Sun Feb 6 19:26:15 GMT 2022


---
 sysdeps/x86_64/memcmp.S                | 2 +-
 sysdeps/x86_64/multiarch/memcmp-sse2.S | 6 ++++--
 sysdeps/x86_64/multiarch/memcmp.c      | 2 --
 sysdeps/x86_64/multiarch/memcmpeq.c    | 2 ++
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/sysdeps/x86_64/memcmp.S b/sysdeps/x86_64/memcmp.S
index e02a53ea1e..2768d45f10 100644
--- a/sysdeps/x86_64/memcmp.S
+++ b/sysdeps/x86_64/memcmp.S
@@ -405,8 +405,8 @@ END(memcmp)
 
 #ifdef USE_AS_MEMCMPEQ
 libc_hidden_def (memcmp)
-#else
 # undef bcmp
 weak_alias (memcmp, bcmp)
+#else
 libc_hidden_builtin_def (memcmp)
 #endif
diff --git a/sysdeps/x86_64/multiarch/memcmp-sse2.S b/sysdeps/x86_64/multiarch/memcmp-sse2.S
index e10555638d..d825c13ede 100644
--- a/sysdeps/x86_64/multiarch/memcmp-sse2.S
+++ b/sysdeps/x86_64/multiarch/memcmp-sse2.S
@@ -29,8 +29,10 @@
 #  define libc_hidden_def(ignored)
 # endif
 
-# undef weak_alias
-# define weak_alias(ignored1, ignored2)
+# ifdef USE_MULTIARCH
+#  undef weak_alias
+#  define weak_alias(ignored1, ignored2)
+# endif
 
 # undef strong_alias
 # define strong_alias(ignored1, ignored2)
diff --git a/sysdeps/x86_64/multiarch/memcmp.c b/sysdeps/x86_64/multiarch/memcmp.c
index 7757d1ec4e..bae29d8dad 100644
--- a/sysdeps/x86_64/multiarch/memcmp.c
+++ b/sysdeps/x86_64/multiarch/memcmp.c
@@ -27,8 +27,6 @@
 # include "ifunc-memcmp.h"
 
 libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR ());
-# undef bcmp
-weak_alias (memcmp, bcmp)
 
 # ifdef SHARED
 __hidden_ver1 (memcmp, __GI_memcmp, __redirect_memcmp)
diff --git a/sysdeps/x86_64/multiarch/memcmpeq.c b/sysdeps/x86_64/multiarch/memcmpeq.c
index aa1c8ad4de..45cb6bad5b 100644
--- a/sysdeps/x86_64/multiarch/memcmpeq.c
+++ b/sysdeps/x86_64/multiarch/memcmpeq.c
@@ -27,6 +27,8 @@
 # include "ifunc-memcmpeq.h"
 
 libc_ifunc_redirected (__redirect___memcmpeq, __memcmpeq, IFUNC_SELECTOR ());
+# undef bcmp
+weak_alias (__memcmpeq, bcmp)
 
 # ifdef SHARED
 __hidden_ver1 (__memcmpeq, __GI___memcmpeq, __redirect___memcmpeq)
-- 
2.34.1



More information about the Libc-alpha mailing list