diff options
author | Elliott Hughes <enh@google.com> | 2013-12-19 12:21:07 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2013-12-19 14:20:22 -0800 |
commit | cd0609f4fcec9bdcb99a2127137c5570b18c499c (patch) | |
tree | c44ef75939752fb371678851d00688bdbd0e27a9 /libc/include/fcntl.h | |
parent | cf7a4a4fda076ec76bb79fdbd039665171e8cd75 (diff) | |
download | android_bionic-cd0609f4fcec9bdcb99a2127137c5570b18c499c.tar.gz android_bionic-cd0609f4fcec9bdcb99a2127137c5570b18c499c.tar.bz2 android_bionic-cd0609f4fcec9bdcb99a2127137c5570b18c499c.zip |
Allow GCC-built fortified code to run on a clang-built bionic.
Even though code built with clang won't be fully fortified
and won't contain calls to our various helpers, binaries built
with GCC will.
Change-Id: I389b2f1e22a3e89b22aadedc46397bf704f9ca79
Diffstat (limited to 'libc/include/fcntl.h')
-rw-r--r-- | libc/include/fcntl.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/libc/include/fcntl.h b/libc/include/fcntl.h index f41cbcc35..ffbbd4742 100644 --- a/libc/include/fcntl.h +++ b/libc/include/fcntl.h @@ -46,15 +46,19 @@ 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) && !defined(__clang__) +#if defined(__BIONIC_FORTIFY) + +extern int __open_2(const char*, int); +extern int __open_real(const char*, int, ...) __asm__(__USER_LABEL_PREFIX__ "open"); +extern int __openat_2(int, const char*, int); +extern int __openat_real(int, const char*, int, ...) __asm__(__USER_LABEL_PREFIX__ "openat"); __errordecl(__creat_missing_mode, "called with O_CREAT, but missing mode"); __errordecl(__creat_too_many_args, "too many arguments"); -extern int __open_real(const char *pathname, int flags, ...) - __asm__(__USER_LABEL_PREFIX__ "open"); -extern int __open_2(const char *, int); + +#if !defined(__clang__) __BIONIC_FORTIFY_INLINE -int open(const char *pathname, int flags, ...) { +int open(const char* pathname, int flags, ...) { if (__builtin_constant_p(flags)) { if ((flags & O_CREAT) && __builtin_va_arg_pack_len() == 0) { __creat_missing_mode(); // compile time error @@ -72,12 +76,8 @@ int open(const char *pathname, int flags, ...) { return __open_real(pathname, flags, __builtin_va_arg_pack()); } -extern int __openat_2(int, const char *, int); -extern int __openat_real(int dirfd, const char *pathname, int flags, ...) - __asm__(__USER_LABEL_PREFIX__ "openat"); - __BIONIC_FORTIFY_INLINE -int openat(int dirfd, const char *pathname, int flags, ...) { +int openat(int dirfd, const char* pathname, int flags, ...) { if (__builtin_constant_p(flags)) { if ((flags & O_CREAT) && __builtin_va_arg_pack_len() == 0) { __creat_missing_mode(); // compile time error @@ -95,7 +95,9 @@ int openat(int dirfd, const char *pathname, int flags, ...) { return __openat_real(dirfd, pathname, flags, __builtin_va_arg_pack()); } -#endif /* defined(__BIONIC_FORTIFY) && !defined(__clang__) */ +#endif /* !defined(__clang__) */ + +#endif /* defined(__BIONIC_FORTIFY) */ __END_DECLS |