diff options
author | Matthew Maurer <mmaurer@google.com> | 2019-09-05 15:55:00 -0700 |
---|---|---|
committer | Matthew Maurer <mmaurer@google.com> | 2019-09-05 16:14:35 -0700 |
commit | 8712b22027e3a6f68536a54ab30c5f814323d53a (patch) | |
tree | 7fcd5a0a38609d64ed91524d866632cabfeda916 /lib | |
parent | 960e1548452a135f2b20fc75dd80ed4655a9d37f (diff) | |
download | common-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.c | 9 |
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"); |