# define attribute_relro
#endif
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#ifdef __UCLIBC_HAS_TLS__
# define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
+#else
+# define attribute_tls_model_ie
+# define __thread
#endif
/* Pull in things like __attribute_used__ */
#include <sys/cdefs.h>
/* --- this is added to integrate linuxthreads */
-#define __USE_UNIX98 1
+/*#define __USE_UNIX98 1*/
#ifndef __ASSEMBLER__
# ifdef IS_IN_libc
# include <stddef.h>
/* sources are built w/ _GNU_SOURCE, this gets undefined */
+#if defined __USE_XOPEN2K && !defined __USE_GNU
+extern char *__glibc_strerror_r (int __errnum, char *__buf, size_t __buflen);
+libc_hidden_proto(__glibc_strerror_r)
+#else
extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen);
-//extern char *__glibc_strerror_r (int __errnum, char *__buf, size_t __buflen);
+libc_hidden_proto(__xpg_strerror_r)
+#endif
/* #include <pthread.h> */
# ifndef __UCLIBC_HAS_THREADS__
# define __pthread_mutex_lock(mutex) ((void)0)
# define __pthread_mutex_trylock(mutex) ((void)0)
# define __pthread_mutex_unlock(mutex) ((void)0)
+# define _pthread_cleanup_push_defer(mutex) ((void)0)
+# define _pthread_cleanup_pop_restore(mutex) ((void)0)
# endif
/* internal access to program name */
extern const char *__uclibc_progname attribute_hidden;
-# endif /* IS_IN_libc */
+# ifdef __UCLIBC_HAS_FORTIFY__
+extern void __chk_fail(void) attribute_noreturn;
+libc_hidden_proto(__chk_fail)
+# endif
-/* #include <alloca.h> */
-#include <bits/stackinfo.h>
-#if _STACK_GROWS_DOWN
-# define extend_alloca(buf, len, newlen) \
- (__typeof (buf)) ({ size_t __newlen = (newlen); \
- char *__newbuf = alloca (__newlen); \
- if (__newbuf + __newlen == (char *) buf) \
- len += __newlen; \
- else \
- len = __newlen; \
- __newbuf; })
-#elif _STACK_GROWS_UP
-# define extend_alloca(buf, len, newlen) \
- (__typeof (buf)) ({ size_t __newlen = (newlen); \
- char *__newbuf = alloca (__newlen); \
- char *__buf = (buf); \
- if (__buf + __newlen == __newbuf) \
- { \
- len += __newlen; \
- __newbuf = __buf; \
- } \
- else \
- len = __newlen; \
- __newbuf; })
-#else
-# warning unknown stack
-# define extend_alloca(buf, len, newlen) \
- alloca (((len) = (newlen)))
-#endif
+# ifdef __UCLIBC_HAS_SSP__
+extern void __stack_chk_fail(void) attribute_noreturn __cold;
+# endif
+
+# endif /* IS_IN_libc */
#endif /* __ASSEMBLER__ */
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+/* Some people like to build up uClibc with *-elf toolchains, so
+ * a little grease here until we drop '#ifdef __linux__' checks
+ * from our source code.
+ */
+#ifndef __linux__
+# define __linux__ 1
+#endif
+
#endif /* _LIBC_INTERNAL_H */