versioner: Fix bzero/bcopy fortify
This commit replaces `bzero` with `__bionic_bzero` and `bcopy` with
`__bionic_bcopy` because `bzero` and `bcopy` are partially defined in
`libc.map.txt`. Bionic versioner raises errors because versioner treats
static inline functions as exported function definitions then it
compares the availability with the information specified in
`libc.map.txt`.
This commit fixes the problem by replacing static inline functions into
`__bionic_{bzero,bcopy}` and defining aliases for source-level
compatibility.
Test: PATH=$(pwd)/prebuilts/clang-tools/linux-x86/bin:$PATH \
bionic/tools/versioner/run_tests.py
Bug: 140110040
Change-Id: I97f2f0dc0abccd0a9fcfe5bb02f4e918362d35cc
diff --git a/libc/include/bits/fortify/strings.h b/libc/include/bits/fortify/strings.h
index 6bda295..385cf77 100644
--- a/libc/include/bits/fortify/strings.h
+++ b/libc/include/bits/fortify/strings.h
@@ -30,7 +30,7 @@
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
__BIONIC_FORTIFY_INLINE
-void bcopy(const void *src, void* const dst __pass_object_size0, size_t len)
+void __bionic_bcopy(const void *src, void* const dst __pass_object_size0, size_t len)
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos0(dst), len),
"'bcopy' called with size bigger than buffer") {
@@ -43,7 +43,7 @@
}
__BIONIC_FORTIFY_INLINE
-void bzero(void* const b __pass_object_size0, size_t len)
+void __bionic_bzero(void* const b __pass_object_size0, size_t len)
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos0(b), len),
"'bzero' called with size bigger than buffer") {
diff --git a/libc/include/strings.h b/libc/include/strings.h
index a054aed..d6ee1c8 100644
--- a/libc/include/strings.h
+++ b/libc/include/strings.h
@@ -52,12 +52,14 @@
__BEGIN_DECLS
/** Deprecated. Use memmove() instead. */
-static __inline__ __always_inline void bcopy(const void* b1, void* b2, size_t len) {
+#define bcopy(b1, b2, len) __bionic_bcopy((b1), (b2), (len))
+static __inline__ __always_inline void __bionic_bcopy(const void* b1, void* b2, size_t len) {
__builtin_memmove(b2, b1, len);
}
/** Deprecated. Use memset() instead. */
-static __inline__ __always_inline void bzero(void* b, size_t len) {
+#define bzero(b, len) __bionic_bzero((b), (len))
+static __inline__ __always_inline void __bionic_bzero(void* b, size_t len) {
__builtin_memset(b, 0, len);
}