From 1fffa01407fddb0166594d1bde4600cd6fa48900 Mon Sep 17 00:00:00 2001
From: "\"Steven J. Hill\"" <sjhill@realitydiluted.com>
Date: Fri, 6 Jan 2006 03:22:19 +0000
Subject: Merge from NPTL branch.

---
 include/alloca.h        |  2 ++
 include/libc-internal.h | 61 +++++++++++++++++++++++++------------------------
 include/link.h          |  2 +-
 3 files changed, 34 insertions(+), 31 deletions(-)

diff --git a/include/alloca.h b/include/alloca.h
index 0dd291f1b..b4fc31738 100644
--- a/include/alloca.h
+++ b/include/alloca.h
@@ -36,6 +36,8 @@ extern void *alloca (size_t __size) __THROW;
 # define alloca(size)	__builtin_alloca (size)
 #endif /* GCC.  */
 
+#define __MAX_ALLOCA_CUTOFF	65536
+
 __END_DECLS
 
 #endif /* alloca.h */
diff --git a/include/libc-internal.h b/include/libc-internal.h
index b07965f33..26e06e636 100644
--- a/include/libc-internal.h
+++ b/include/libc-internal.h
@@ -326,36 +326,6 @@ extern int __sprintf (char *__restrict __s,
 #define fopen64 __fopen64
 #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
-
 /* #include <stdlib.h> */
 extern char *__getenv (__const char *__name) attribute_hidden;
 extern void __exit (int __status) __THROW __attribute__ ((__noreturn__)) attribute_hidden;
@@ -478,6 +448,37 @@ extern int __gettimeofday(struct timeval *__restrict __tv, *__restrict __timezon
 extern const char *__uclibc_progname attribute_hidden;
 
 # endif /* IS_IN_libc */
+
+/* #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
+
 #endif /* __ASSEMBLER__ */
 
 #endif /* _LIBC_INTERNAL_H */
diff --git a/include/link.h b/include/link.h
index dc6502476..1dd1c4c46 100644
--- a/include/link.h
+++ b/include/link.h
@@ -25,7 +25,7 @@
 #include <elf.h>
 #include <dlfcn.h>
 #include <sys/types.h>
-#ifdef _LIBC
+#if defined _LIBC && defined __UCLIBC_HAS_THREADS_NATIVE__
 #include <tls.h>
 #endif
 
-- 
cgit v1.2.3