diff --git a/libc/bionic/__errno.c b/libc/bionic/__errno.c index ffc6e610c..8f33ccedd 100644 --- a/libc/bionic/__errno.c +++ b/libc/bionic/__errno.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. */ #include -#include +#include volatile int* __errno( void ) { diff --git a/libc/bionic/libc_init_common.c b/libc/bionic/libc_init_common.c index 0944cb05f..de4919d27 100644 --- a/libc/bionic/libc_init_common.c +++ b/libc/bionic/libc_init_common.c @@ -36,7 +36,7 @@ #include "atexit.h" #include "libc_init_common.h" -#include +#include #include extern void _init(void); diff --git a/libc/bionic/libc_init_static.c b/libc/bionic/libc_init_static.c index f5a1d8047..ec463f7ec 100644 --- a/libc/bionic/libc_init_static.c +++ b/libc/bionic/libc_init_static.c @@ -55,7 +55,7 @@ #include "atexit.h" #include "libc_init_common.h" -#include +#include #include __noreturn void __libc_init(uintptr_t *elfdata, diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c index 2fd740ed2..6114f40eb 100644 --- a/libc/bionic/pthread.c +++ b/libc/bionic/pthread.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libc/include/stdio.h b/libc/include/stdio.h index b3b0adfe8..79e526b7c 100644 --- a/libc/include/stdio.h +++ b/libc/include/stdio.h @@ -41,6 +41,16 @@ #include #include +/* va_list and size_t must be defined by stdio.h according to Posix */ +#define __need___va_list +#include + +/* note that this forces stddef.h to *only* define size_t */ +#define __need_size_t +#include + +#include + #if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE #include /* XXX should be removed */ #endif diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h index a821e031e..acfe69424 100644 --- a/libc/include/stdlib.h +++ b/libc/include/stdlib.h @@ -29,6 +29,13 @@ #define _STDLIB_H_ #include + +/* wchar_t is required in stdlib.h according to POSIX. + * note that defining __need_wchar_t prevents stddef.h + * to define all other symbols it does normally */ +#define __need_wchar_t +#include + #include #include #include diff --git a/libc/include/sys/android/atomics.h b/libc/include/sys/android/atomics.h deleted file mode 100644 index 75017b959..000000000 --- a/libc/include/sys/android/atomics.h +++ /dev/null @@ -1 +0,0 @@ -#include \ No newline at end of file diff --git a/libc/include/sys/android/tls.h b/libc/include/sys/android/tls.h deleted file mode 100644 index 274ac3572..000000000 --- a/libc/include/sys/android/tls.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h index 7ab0f82e6..5e6363ff4 100644 --- a/libc/include/sys/stat.h +++ b/libc/include/sys/stat.h @@ -77,6 +77,10 @@ extern int lstat(const char *, struct stat *); extern int mknod(const char *, mode_t, dev_t); extern mode_t umask(mode_t); +#define stat64 stat +#define fstat64 fstat +#define lstat64 lstat + static __inline__ int mkfifo(const char *__p, mode_t __m) { return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t)0); diff --git a/libc/include/wchar.h b/libc/include/wchar.h index 3dadc982f..e2feb6002 100644 --- a/libc/include/wchar.h +++ b/libc/include/wchar.h @@ -30,11 +30,17 @@ #include #include + +/* wchar_t is required in stdlib.h according to POSIX */ +#define __need___wchar_t #include + #include #include #include +#include + /* IMPORTANT: Any code that relies on wide character support is essentially * non-portable and/or broken. the only reason this header exist * is because I'm really a nice guy. However, I'm not nice enough @@ -44,11 +50,6 @@ __BEGIN_DECLS -#ifndef __cplusplus -/* wchar_t is a builtin keyword of g++ */ -typedef unsigned char wchar_t; -#endif - typedef int wint_t; typedef struct { int dummy; } mbstate_t; diff --git a/libc/include/sys/tls.h b/libc/private/bionic_tls.h similarity index 100% rename from libc/include/sys/tls.h rename to libc/private/bionic_tls.h diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c index a19edbb36..d3089a4a4 100644 --- a/libc/unistd/sysconf.c +++ b/libc/unistd/sysconf.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include /* for FOPEN_MAX */ #include diff --git a/linker/Android.mk b/linker/Android.mk index 5d1114854..98eceda14 100644 --- a/linker/Android.mk +++ b/linker/Android.mk @@ -18,6 +18,10 @@ LOCAL_LDFLAGS := -Wl,-Ttext,$(LINKER_TEXT_BASE) LOCAL_CFLAGS += -DPRELINK -DLINKER_TEXT_BASE=$(LINKER_TEXT_BASE) -DLINKER_AREA_SIZE=$(LINKER_AREA_SIZE) +# we need to access the Bionic private header +# in the linker +LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/private + ifeq ($(TARGET_ARCH),arm) LOCAL_CFLAGS += -DANDROID_ARM_LINKER else diff --git a/linker/linker.c b/linker/linker.c index 34ed80eff..8f15f6277 100644 --- a/linker/linker.c +++ b/linker/linker.c @@ -14,7 +14,9 @@ #include #include -#include + +/* special private C library header - see Android.mk */ +#include #include "linker.h" #include "linker_debug.h"