diff options
Diffstat (limited to 'libc/include')
-rw-r--r-- | libc/include/fcntl.h | 4 | ||||
-rw-r--r-- | libc/include/stdio.h | 4 | ||||
-rw-r--r-- | libc/include/string.h | 22 | ||||
-rw-r--r-- | libc/include/strings.h | 4 | ||||
-rw-r--r-- | libc/include/sys/cdefs.h | 5 | ||||
-rw-r--r-- | libc/include/sys/stat.h | 4 |
6 files changed, 26 insertions, 17 deletions
diff --git a/libc/include/fcntl.h b/libc/include/fcntl.h index 67fd597..94322fd 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) +#if defined(__BIONIC_FORTIFY) && !defined(__clang__) __errordecl(__creat_error, "called with O_CREAT, but missing mode"); __errordecl(__too_many_args_error, "too many arguments"); extern int __open_real(const char *pathname, int flags, ...) @@ -98,7 +98,7 @@ int openat(int dirfd, const char *pathname, int flags, ...) { return __openat_real(dirfd, pathname, flags, __builtin_va_arg_pack()); } -#endif /* defined(__BIONIC_FORTIFY) */ +#endif /* defined(__BIONIC_FORTIFY) && !defined(__clang__) */ __END_DECLS diff --git a/libc/include/stdio.h b/libc/include/stdio.h index 154a86c..511bcd2 100644 --- a/libc/include/stdio.h +++ b/libc/include/stdio.h @@ -450,7 +450,7 @@ int vfdprintf(int, const char*, __va_list) __END_DECLS #endif /* _GNU_SOURCE */ -#if defined(__BIONIC_FORTIFY) +#if defined(__BIONIC_FORTIFY) && !defined(__clang__) __BEGIN_DECLS @@ -523,6 +523,6 @@ char *fgets(char *dest, int size, FILE *stream) __END_DECLS -#endif /* defined(__BIONIC_FORTIFY) */ +#endif /* defined(__BIONIC_FORTIFY) && !defined(__clang__) */ #endif /* _STDIO_H_ */ diff --git a/libc/include/string.h b/libc/include/string.h index 3c9fc21..ac31f7d 100644 --- a/libc/include/string.h +++ b/libc/include/string.h @@ -91,7 +91,7 @@ __errordecl(__memcpy_dest_size_error, "memcpy called with size bigger than desti __errordecl(__memcpy_src_size_error, "memcpy called with size bigger than source"); __BIONIC_FORTIFY_INLINE -void *memcpy (void* __restrict dest, const void* __restrict src, size_t copy_amount) { +void* memcpy(void* __restrict dest, const void* __restrict src, size_t copy_amount) { char *d = (char *) dest; const char *s = (const char *) src; size_t s_len = __builtin_object_size(s, 0); @@ -109,19 +109,19 @@ void *memcpy (void* __restrict dest, const void* __restrict src, size_t copy_amo } __BIONIC_FORTIFY_INLINE -void *memmove (void *dest, const void *src, size_t len) { +void* memmove(void *dest, const void *src, size_t len) { return __builtin___memmove_chk(dest, src, len, __builtin_object_size (dest, 0)); } __BIONIC_FORTIFY_INLINE -char *strcpy(char* __restrict dest, const char* __restrict src) { +char* strcpy(char* __restrict dest, const char* __restrict src) { return __builtin___strcpy_chk(dest, src, __bos(dest)); } __errordecl(__strncpy_error, "strncpy called with size bigger than buffer"); __BIONIC_FORTIFY_INLINE -char *strncpy(char* __restrict dest, const char* __restrict src, size_t n) { +char* strncpy(char* __restrict dest, const char* __restrict src, size_t n) { size_t bos = __bos(dest); if (__builtin_constant_p(n) && (n > bos)) { __strncpy_error(); @@ -130,7 +130,7 @@ char *strncpy(char* __restrict dest, const char* __restrict src, size_t n) { } __BIONIC_FORTIFY_INLINE -char *strcat(char* __restrict dest, const char* __restrict src) { +char* strcat(char* __restrict dest, const char* __restrict src) { return __builtin___strcat_chk(dest, src, __bos(dest)); } @@ -140,10 +140,11 @@ char *strncat(char* __restrict dest, const char* __restrict src, size_t n) { } __BIONIC_FORTIFY_INLINE -void *memset (void *s, int c, size_t n) { +void* memset(void *s, int c, size_t n) { return __builtin___memset_chk(s, c, n, __builtin_object_size (s, 0)); } +#if !defined(__clang__) extern size_t __strlcpy_real(char* __restrict, const char* __restrict, size_t) __asm__(__USER_LABEL_PREFIX__ "strlcpy"); __errordecl(__strlcpy_error, "strlcpy called with size bigger than buffer"); @@ -172,7 +173,9 @@ size_t strlcpy(char* __restrict dest, const char* __restrict src, size_t size) { return __strlcpy_chk(dest, src, size, bos); } +#endif /* !defined(__clang__) */ +#if !defined(__clang__) extern size_t __strlcat_real(char* __restrict, const char* __restrict, size_t) __asm__(__USER_LABEL_PREFIX__ "strlcat"); __errordecl(__strlcat_error, "strlcat called with size bigger than buffer"); @@ -202,11 +205,13 @@ size_t strlcat(char* __restrict dest, const char* __restrict src, size_t size) { return __strlcat_chk(dest, src, size, bos); } +#endif /* !defined(__clang__) */ __BIONIC_FORTIFY_INLINE size_t strlen(const char *s) { size_t bos = __bos(s); +#if !defined(__clang__) // Compiler doesn't know destination size. Don't call __strlen_chk if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) { return __builtin_strlen(s); @@ -216,6 +221,7 @@ size_t strlen(const char *s) { if (__builtin_constant_p(slen)) { return slen; } +#endif /* !defined(__clang__) */ return __strlen_chk(s, bos); } @@ -226,6 +232,7 @@ __BIONIC_FORTIFY_INLINE char* strchr(const char *s, int c) { size_t bos = __bos(s); +#if !defined(__clang__) // Compiler doesn't know destination size. Don't call __strchr_chk if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) { return __builtin_strchr(s, c); @@ -235,6 +242,7 @@ char* strchr(const char *s, int c) { if (__builtin_constant_p(slen) && (slen < bos)) { return __builtin_strchr(s, c); } +#endif /* !defined(__clang__) */ return __strchr_chk(s, c, bos); } @@ -245,6 +253,7 @@ __BIONIC_FORTIFY_INLINE char* strrchr(const char *s, int c) { size_t bos = __bos(s); +#if !defined(__clang__) // Compiler doesn't know destination size. Don't call __strrchr_chk if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) { return __builtin_strrchr(s, c); @@ -254,6 +263,7 @@ char* strrchr(const char *s, int c) { if (__builtin_constant_p(slen) && (slen < bos)) { return __builtin_strrchr(s, c); } +#endif /* !defined(__clang__) */ return __strrchr_chk(s, c, bos); } diff --git a/libc/include/strings.h b/libc/include/strings.h index e72798b..faa12a4 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) +#if defined(__BIONIC_FORTIFY) && !defined(__clang__) __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) */ +#endif /* defined(__BIONIC_FORTIFY) && !defined(__clang__) */ __END_DECLS diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h index 78513e3..c7fb9de 100644 --- a/libc/include/sys/cdefs.h +++ b/libc/include/sys/cdefs.h @@ -524,7 +524,7 @@ #define __BIONIC__ 1 #include <android/api-level.h> -#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 && !defined(__clang__) +#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 #define __BIONIC_FORTIFY 1 #if _FORTIFY_SOURCE == 2 #define __bos(s) __builtin_object_size((s), 1) @@ -535,8 +535,7 @@ #define __BIONIC_FORTIFY_INLINE \ extern inline \ __attribute__ ((always_inline)) \ - __attribute__ ((gnu_inline)) \ - __attribute__ ((artificial)) + __attribute__ ((gnu_inline)) #endif #define __BIONIC_FORTIFY_UNKNOWN_SIZE ((size_t) -1) diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h index da49e1a..cf0d82d 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) +#if defined(__BIONIC_FORTIFY) && !defined(__clang__) extern mode_t __umask_chk(mode_t); extern mode_t __umask_real(mode_t) @@ -146,7 +146,7 @@ mode_t umask(mode_t mode) { } return __umask_chk(mode); } -#endif /* defined(__BIONIC_FORTIFY) */ +#endif /* defined(__BIONIC_FORTIFY) && !defined(__clang__) */ #define stat64 stat |