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
This commit is contained in:
Elliott Hughes
2013-12-19 12:21:07 -08:00
parent cf7a4a4fda
commit cd0609f4fc
2 changed files with 18 additions and 17 deletions

View File

@@ -495,16 +495,15 @@ int sprintf(char *dest, const char *format, ...)
}
#endif
#if !defined(__clang__)
extern char *__fgets_real(char *, int, FILE *)
__asm__(__USER_LABEL_PREFIX__ "fgets");
extern char* __fgets_chk(char*, int, FILE*, size_t);
extern char* __fgets_real(char*, int, FILE*) __asm__(__USER_LABEL_PREFIX__ "fgets");
__errordecl(__fgets_too_big_error, "fgets called with size bigger than buffer");
__errordecl(__fgets_too_small_error, "fgets called with size less than zero");
extern char *__fgets_chk(char *, int, FILE *, size_t);
#if !defined(__clang__)
__BIONIC_FORTIFY_INLINE
char *fgets(char *dest, int size, FILE *stream)
{
char *fgets(char* dest, int size, FILE* stream) {
size_t bos = __bos(dest);
// Compiler can prove, at compile time, that the passed in size