Inline helpers need to be exported unmangled.

__open_2() is used by the fortify implementation of open(2) in
fcntl.h, and as such needs an unmangled C name. For some reason
(inlining?), this doesn't cause problems at the default optimization
level, but does for -O0.

The rest of these didn't cause build failures, but they look suspect
and probably will, we just haven't caught them yet.

Bug: 17784968
Change-Id: I7391a7a8999ee204eaf6abd14a3d5373ea419d5b
This commit is contained in:
Dan Albert
2014-10-07 11:10:36 -07:00
parent eeb9aa02b7
commit 658727e111
9 changed files with 32 additions and 45 deletions

View File

@@ -55,6 +55,8 @@
#define __need_NULL
#include <stddef.h>
__BEGIN_DECLS
#define _FSTDIO /* Define for new stdio with functions. */
typedef off_t fpos_t; /* stdio file position type */
@@ -144,9 +146,7 @@ typedef struct __sFILE {
fpos_t _offset; /* current lseek offset */
} FILE;
__BEGIN_DECLS
extern FILE __sF[];
__END_DECLS
#define __SLBF 0x0001 /* line buffered */
#define __SNBF 0x0002 /* unbuffered */
@@ -216,7 +216,6 @@ __END_DECLS
/*
* Functions defined in ANSI C standard.
*/
__BEGIN_DECLS
void clearerr(FILE *);
int fclose(FILE *);
int feof(FILE *);
@@ -304,16 +303,12 @@ int vsscanf(const char * __restrict, const char * __restrict, __va_list)
__scanflike(2, 0);
#endif /* __ISO_C_VISIBLE >= 1999 || __BSD_VISIBLE */
__END_DECLS
/*
* Functions defined in POSIX 1003.1.
*/
#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
#define L_ctermid 1024 /* size for ctermid(); PATH_MAX */
__BEGIN_DECLS
FILE *fdopen(int, const char *);
int fileno(FILE *);
@@ -342,15 +337,12 @@ FILE* fmemopen(void*, size_t, const char*);
FILE* open_memstream(char**, size_t*);
#endif /* __POSIX_VISIBLE >= 200809 */
__END_DECLS
#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */
/*
* Routines that are purely local.
*/
#if __BSD_VISIBLE
__BEGIN_DECLS
int asprintf(char ** __restrict, const char * __restrict, ...)
__printflike(2, 3);
char *fgetln(FILE * __restrict, size_t * __restrict);
@@ -365,25 +357,25 @@ void clearerr_unlocked(FILE*);
int feof_unlocked(FILE*);
int ferror_unlocked(FILE*);
__END_DECLS
/*
* Stdio function-access interface.
*/
__BEGIN_DECLS
FILE *funopen(const void *,
int (*)(void *, char *, int),
int (*)(void *, const char *, int),
fpos_t (*)(void *, fpos_t, int),
int (*)(void *));
__END_DECLS
#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
#endif /* __BSD_VISIBLE */
#if defined(__BIONIC_FORTIFY)
extern char* __fgets_chk(char*, int, FILE*, size_t);
extern char* __fgets_real(char*, int, FILE*) __RENAME(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");
__BEGIN_DECLS
#if defined(__BIONIC_FORTIFY)
__BIONIC_FORTIFY_INLINE
__printflike(3, 0)
@@ -429,11 +421,6 @@ int sprintf(char *dest, const char *format, ...)
}
#endif
extern char* __fgets_chk(char*, int, FILE*, size_t);
extern char* __fgets_real(char*, int, FILE*) __RENAME(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");
#if !defined(__clang__)
__BIONIC_FORTIFY_INLINE
@@ -468,8 +455,8 @@ char *fgets(char* dest, int size, FILE* stream) {
#endif /* !defined(__clang__) */
__END_DECLS
#endif /* defined(__BIONIC_FORTIFY) */
__END_DECLS
#endif /* _STDIO_H_ */