versioner: Add __VERSIONER_FORTIFY_INLINE
This commit adds `__VERSIONER_FORTIFY_INLINE` to fortify overload
functions. Fortified functions are always overloaded and are likely to
be different from `libc.map.txt`.
Bug: 118991081
Test: source development/vndk/tools/header-checker/android/envsetup.sh && \
source build/envsetup.sh && \
lunch aosp_arm64-userdebug && \
m versioner && \
./bionic/tools/versioner/run_tests.py
Change-Id: I28903d0f039d74a07eb2833c754ff017335bac95
diff --git a/libc/include/android/versioning.h b/libc/include/android/versioning.h
index 1c73028..1948890 100644
--- a/libc/include/android/versioning.h
+++ b/libc/include/android/versioning.h
@@ -30,6 +30,7 @@
#define __INTRODUCED_IN_MIPS(api_level) __attribute__((annotate("introduced_in_mips=" #api_level)))
#define __VERSIONER_NO_GUARD __attribute__((annotate("versioner_no_guard")))
+#define __VERSIONER_FORTIFY_INLINE __attribute__((annotate("versioner_fortify_inline")))
#else
@@ -43,5 +44,6 @@
#define __INTRODUCED_IN_MIPS(api_level)
#define __VERSIONER_NO_GUARD
+#define __VERSIONER_FORTIFY_INLINE
#endif // defined(__BIONIC_VERSIONER)
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index eb30690..9e214e5 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -277,7 +277,7 @@
* Because clang-FORTIFY uses overloads, we can't mark functions as `extern
* inline` without making them available externally.
*/
-# define __BIONIC_FORTIFY_INLINE static __inline__ __always_inline
+# define __BIONIC_FORTIFY_INLINE static __inline__ __always_inline __VERSIONER_FORTIFY_INLINE
/*
* We should use __BIONIC_FORTIFY_VARIADIC instead of __BIONIC_FORTIFY_INLINE
* for variadic functions because compilers cannot inline them.