summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-03-22 10:58:55 -0700
committerElliott Hughes <enh@google.com>2013-03-22 10:58:55 -0700
commit890c8ed6ef773160cd6840a92e0d469fe530871f (patch)
tree6689569955f500ea13697ea928386dd9c64d1af3
parent34895c1bdfa5df48ee9a7b4368b6def403f24cf1 (diff)
downloadbionic-890c8ed6ef773160cd6840a92e0d469fe530871f.zip
bionic-890c8ed6ef773160cd6840a92e0d469fe530871f.tar.gz
bionic-890c8ed6ef773160cd6840a92e0d469fe530871f.tar.bz2
Fix builds where _FORTIFY_SOURCE is off.
Also add a more intention-revealing guard so we don't have loads of places checking whether our inlining macro is defined. Change-Id: I168860cedcfc798b07a5145bc48a125700265e47
-rw-r--r--libc/include/fcntl.h4
-rw-r--r--libc/include/stdio.h4
-rw-r--r--libc/include/string.h4
-rw-r--r--libc/include/strings.h4
-rw-r--r--libc/include/sys/cdefs.h3
-rw-r--r--libc/include/sys/stat.h4
6 files changed, 12 insertions, 11 deletions
diff --git a/libc/include/fcntl.h b/libc/include/fcntl.h
index 7ab7205..de2e3e3 100644
--- a/libc/include/fcntl.h
+++ b/libc/include/fcntl.h
@@ -49,7 +49,7 @@ extern int unlinkat(int dirfd, const char *pathname, int flags);
extern int fcntl(int fd, int command, ...);
extern int creat(const char* path, mode_t mode);
-#if defined(__BIONIC_FORTIFY_INLINE)
+#if defined(__BIONIC_FORTIFY)
extern void __creat_error()
__attribute__((__error__ ("called with O_CREAT, but missing mode")));
@@ -101,7 +101,7 @@ int openat(int dirfd, const char *pathname, int flags, ...) {
return __openat_real(dirfd, pathname, flags, __builtin_va_arg_pack());
}
-#endif /* defined(__BIONIC_FORTIFY_INLINE) */
+#endif /* defined(__BIONIC_FORTIFY) */
__END_DECLS
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 62882db..fdf747d 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -457,7 +457,7 @@ int vfdprintf(int, const char*, __va_list)
__END_DECLS
#endif /* _GNU_SOURCE */
-#if defined(__BIONIC_FORTIFY_INLINE)
+#if defined(__BIONIC_FORTIFY)
__BEGIN_DECLS
@@ -538,6 +538,6 @@ char *fgets(char *dest, int size, FILE *stream)
__END_DECLS
-#endif /* defined(__BIONIC_FORTIFY_INLINE) */
+#endif /* defined(__BIONIC_FORTIFY) */
#endif /* _STDIO_H_ */
diff --git a/libc/include/string.h b/libc/include/string.h
index 63e768e..56d89a4 100644
--- a/libc/include/string.h
+++ b/libc/include/string.h
@@ -84,7 +84,7 @@ extern char* strsignal(int sig);
extern int strcoll(const char *, const char *) __purefunc;
extern size_t strxfrm(char *, const char *, size_t);
-#if defined(__BIONIC_FORTIFY_INLINE)
+#if defined(__BIONIC_FORTIFY)
extern void __memcpy_dest_size_error()
__attribute__((__error__("memcpy called with size bigger than destination")));
@@ -258,7 +258,7 @@ char* strrchr(const char *s, int c) {
}
-#endif /* defined(__BIONIC_FORTIFY_INLINE) */
+#endif /* defined(__BIONIC_FORTIFY) */
__END_DECLS
diff --git a/libc/include/strings.h b/libc/include/strings.h
index 0ee691d..e72798b 100644
--- a/libc/include/strings.h
+++ b/libc/include/strings.h
@@ -50,12 +50,12 @@ char *index(const char *, int);
int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, size_t);
-#if defined(__BIONIC_FORTIFY_INLINE)
+#if defined(__BIONIC_FORTIFY)
__BIONIC_FORTIFY_INLINE
void bzero (void *s, size_t n) {
__builtin___memset_chk(s, '\0', n, __builtin_object_size (s, 0));
}
-#endif /* defined(__BIONIC_FORTIFY_INLINE) */
+#endif /* defined(__BIONIC_FORTIFY) */
__END_DECLS
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 3617aba..1976d6a 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -516,13 +516,14 @@
#include <android/api-level.h>
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 && !defined(__clang__)
+#define __BIONIC_FORTIFY 1
#define __BIONIC_FORTIFY_INLINE \
extern inline \
__attribute__ ((always_inline)) \
__attribute__ ((gnu_inline)) \
__attribute__ ((artificial))
-#define __BIONIC_FORTIFY_UNKNOWN_SIZE ((size_t) -1)
#endif
+#define __BIONIC_FORTIFY_UNKNOWN_SIZE ((size_t) -1)
/* Android-added: for FreeBSD's libm. */
#define __weak_reference(sym,alias) \
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index 05b221f..4e8beb6 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -129,7 +129,7 @@ extern int lstat(const char *, struct stat *);
extern int mknod(const char *, mode_t, dev_t);
extern mode_t umask(mode_t);
-#if defined(__BIONIC_FORTIFY_INLINE)
+#if defined(__BIONIC_FORTIFY)
extern mode_t __umask_chk(mode_t);
extern mode_t __umask_real(mode_t)
@@ -147,7 +147,7 @@ mode_t umask(mode_t mode) {
}
return __umask_chk(mode);
}
-#endif /* defined(__BIONIC_FORTIFY_INLINE) */
+#endif /* defined(__BIONIC_FORTIFY) */
#define stat64 stat