aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatthew Maurer <mmaurer@google.com>2019-09-05 15:55:00 -0700
committerMatthew Maurer <mmaurer@google.com>2019-09-05 16:14:35 -0700
commit8712b22027e3a6f68536a54ab30c5f814323d53a (patch)
tree7fcd5a0a38609d64ed91524d866632cabfeda916 /lib
parent960e1548452a135f2b20fc75dd80ed4655a9d37f (diff)
downloadcommon-8712b22027e3a6f68536a54ab30c5f814323d53a.tar.gz
Provide bcmp in the kernel
New Clang will call out to bcmp instead of memcmp in some situations. Providing bcmp allows us to use these newer compilers. Bug: 140579848 Change-Id: I0b1d8443e2366a8f258177516e782a26087b86a2
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/string/memcmp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/libc/string/memcmp.c b/lib/libc/string/memcmp.c
index 87608b9c..c9e6a64e 100644
--- a/lib/libc/string/memcmp.c
+++ b/lib/libc/string/memcmp.c
@@ -27,6 +27,8 @@
#include <string.h>
#include <sys/types.h>
+#include <lk/compiler.h>
+
int
memcmp(const void *cs, const void *ct, size_t count)
{
@@ -38,3 +40,10 @@ memcmp(const void *cs, const void *ct, size_t count)
break;
return res;
}
+
+/*
+ * Any compliant memcmp implementation is a bcmp implementation. Modern clang
+ * sometimes generates bcmp calls, and we do not have a specialized bcmp
+ * implementation.
+ */
+int bcmp(const void *cs, const void *ct, size_t count) __WEAK_ALIAS("memcmp");