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/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index f0a7026..2c3299f 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -243,23 +243,15 @@
return signal(signum, handler);
}
-// bcopy/bzero were previously `#define`d, so we only have `static` wrappers in
-// Bionic headers. Since we have header definitions, we need some way to
-// overload these implementations; __never_call will ensure that any calls to
-// bcopy/bzero call the in-header implementation. Since the implementations
-// should end up functionally identical, it doesn't matter which we actually
-// call.
-#define __never_call __attribute__((enable_if(false, "never selected")))
-
// This was removed from POSIX 2008.
-void bcopy(const void* src, void* dst, size_t n) __never_call __RENAME(bcopy);
-void bcopy(const void* src, void* dst, size_t n) __never_call {
+#undef bcopy
+void bcopy(const void* src, void* dst, size_t n) {
memmove(dst, src, n);
}
// This was removed from POSIX 2008.
-void bzero(void* dst, size_t n) __never_call __RENAME(bzero);
-void bzero(void* dst, size_t n) __never_call {
+#undef bzero
+void bzero(void* dst, size_t n) {
memset(dst, 0, n);
}