Add workarounds for current compilers
With current compilers, we're getting "this function cannot be inlined"
errors on vsnprintf and strlcpy because the always_inline attribute is
set.
Before marking this a "fix" instead of a "workaround", we should figure
out why the functions can't be inlined.
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index fdf747d..4fefd2c 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -460,8 +460,7 @@
#if defined(__BIONIC_FORTIFY)
__BEGIN_DECLS
-
-__BIONIC_FORTIFY_INLINE
+__BIONIC_FORTIFY_INLINE_WITHOUT_ALWAYS
__attribute__((__format__ (printf, 3, 0)))
__attribute__((__nonnull__ (3)))
int vsnprintf(char *dest, size_t size, const char *format, __va_list ap)
diff --git a/libc/include/string.h b/libc/include/string.h
index 56d89a4..7ba9916 100644
--- a/libc/include/string.h
+++ b/libc/include/string.h
@@ -145,7 +145,7 @@
__attribute__((__error__("strlcpy called with size bigger than buffer")));
extern size_t __strlcpy_chk(char *, const char *, size_t, size_t);
-__BIONIC_FORTIFY_INLINE
+__BIONIC_FORTIFY_INLINE_WITHOUT_ALWAYS
size_t strlcpy(char *dest, const char *src, size_t size) {
size_t bos = __builtin_object_size(dest, 0);
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 1976d6a..070626d 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -522,6 +522,10 @@
__attribute__ ((always_inline)) \
__attribute__ ((gnu_inline)) \
__attribute__ ((artificial))
+#define __BIONIC_FORTIFY_INLINE_WITHOUT_ALWAYS \
+ extern inline \
+ __attribute__ ((gnu_inline)) \
+ __attribute__ ((artificial))
#endif
#define __BIONIC_FORTIFY_UNKNOWN_SIZE ((size_t) -1)