00db10
diff --git glibc-2.17-c758a686/elf/tst-stackguard1.c glibc-2.17-c758a686/elf/tst-stackguard1.c
00db10
index 2b4fd9a..fba60bd 100644
00db10
--- glibc-2.17-c758a686/elf/tst-stackguard1.c
00db10
+++ glibc-2.17-c758a686/elf/tst-stackguard1.c
00db10
@@ -23,6 +23,7 @@
00db10
 #include <string.h>
00db10
 #include <sys/wait.h>
00db10
 #include <stackguard-macros.h>
00db10
+#include <tls.h>
00db10
 #include <unistd.h>
00db10
 
00db10
 static const char *command;
00db10
diff --git glibc-2.17-c758a686/include/errno.h glibc-2.17-c758a686/include/errno.h
00db10
index 98c6080..f1b93a8 100644
00db10
--- glibc-2.17-c758a686/include/errno.h
00db10
+++ glibc-2.17-c758a686/include/errno.h
00db10
@@ -17,7 +17,7 @@
00db10
 #  define errno rtld_errno
00db10
 extern int rtld_errno attribute_hidden;
00db10
 
00db10
-# else
00db10
+# elif !defined NOT_IN_libc || defined IN_LIB
00db10
 
00db10
 #  include <tls.h>
00db10
 
00db10
@@ -29,7 +29,7 @@ extern int rtld_errno attribute_hidden;
00db10
 #  endif
00db10
 extern __thread int errno attribute_tls_model_ie;
00db10
 
00db10
-# endif	/* RTLD_PRIVATE_ERRNO */
00db10
+# endif	/* !NOT_IN_libc || IN_LIB */
00db10
 
00db10
 # define __set_errno(val) (errno = (val))
00db10
 
00db10
diff --git glibc-2.17-c758a686/include/netdb.h glibc-2.17-c758a686/include/netdb.h
00db10
index 3f2ae06..8a569ba 100644
00db10
--- glibc-2.17-c758a686/include/netdb.h
00db10
+++ glibc-2.17-c758a686/include/netdb.h
00db10
@@ -3,18 +3,20 @@
00db10
 
00db10
 #ifndef _ISOMAC
00db10
 /* Macros for accessing h_errno from inside libc.  */
00db10
-# undef  h_errno
00db10
-# ifdef _LIBC_REENTRANT
00db10
-#  include <tls.h>
00db10
-#  ifndef NOT_IN_libc
00db10
-#   define h_errno __libc_h_errno
00db10
-#  else
00db10
-#   define h_errno h_errno	/* For #ifndef h_errno tests.  */
00db10
-#  endif
00db10
+# if !defined NOT_IN_libc || defined IN_LIB
00db10
+#  undef  h_errno
00db10
+#  ifdef _LIBC_REENTRANT
00db10
+#   include <tls.h>
00db10
+#   ifndef NOT_IN_libc
00db10
+#    define h_errno __libc_h_errno
00db10
+#   else
00db10
+#    define h_errno h_errno	/* For #ifndef h_errno tests.  */
00db10
+#   endif
00db10
 extern __thread int h_errno attribute_tls_model_ie;
00db10
-# else
00db10
+#  else
00db10
 extern int h_errno;
00db10
-# endif	/* _LIBC_REENTRANT */
00db10
+#  endif	/* _LIBC_REENTRANT */
00db10
+# endif /* !NOT_IN_libc || IN_LIB */
00db10
 # define __set_h_errno(x) (h_errno = (x))
00db10
 
00db10
 libc_hidden_proto (hstrerror)
00db10
diff --git glibc-2.17-c758a686/nptl/tst-cancel14.c glibc-2.17-c758a686/nptl/tst-cancel14.c
00db10
index fbaed49..ca9042d 100644
00db10
--- glibc-2.17-c758a686/nptl/tst-cancel14.c
00db10
+++ glibc-2.17-c758a686/nptl/tst-cancel14.c
00db10
@@ -23,6 +23,7 @@
00db10
 #include <stdlib.h>
00db10
 #include <string.h>
00db10
 #include <unistd.h>
00db10
+#include <sys/time.h>
00db10
 
00db10
 
00db10
 static pthread_barrier_t bar;
00db10
diff --git glibc-2.17-c758a686/nptl/tst-cancel15.c glibc-2.17-c758a686/nptl/tst-cancel15.c
00db10
index 0119cc7..3f320ad 100644
00db10
--- glibc-2.17-c758a686/nptl/tst-cancel15.c
00db10
+++ glibc-2.17-c758a686/nptl/tst-cancel15.c
00db10
@@ -23,6 +23,7 @@
00db10
 #include <stdlib.h>
00db10
 #include <string.h>
00db10
 #include <unistd.h>
00db10
+#include <sys/time.h>
00db10
 
00db10
 
00db10
 static pthread_barrier_t bar;
00db10
diff --git glibc-2.17-c758a686/nptl/tst-mutex9.c glibc-2.17-c758a686/nptl/tst-mutex9.c
00db10
index adb3b61..1d689bd 100644
00db10
--- glibc-2.17-c758a686/nptl/tst-mutex9.c
00db10
+++ glibc-2.17-c758a686/nptl/tst-mutex9.c
00db10
@@ -18,10 +18,13 @@
00db10
 
00db10
 #include <errno.h>
00db10
 #include <pthread.h>
00db10
+#include <stdint.h>
00db10
 #include <stdio.h>
00db10
+#include <stdlib.h>
00db10
 #include <string.h>
00db10
 #include <unistd.h>
00db10
 #include <sys/mman.h>
00db10
+#include <sys/time.h>
00db10
 #include <sys/wait.h>
00db10
 
00db10
 
00db10
diff --git glibc-2.17-c758a686/nptl/tst-stackguard1.c glibc-2.17-c758a686/nptl/tst-stackguard1.c
00db10
index f0f707f..57a48ad 100644
00db10
--- glibc-2.17-c758a686/nptl/tst-stackguard1.c
00db10
+++ glibc-2.17-c758a686/nptl/tst-stackguard1.c
00db10
@@ -24,6 +24,7 @@
00db10
 #include <string.h>
00db10
 #include <sys/wait.h>
00db10
 #include <stackguard-macros.h>
00db10
+#include <tls.h>
00db10
 #include <unistd.h>
00db10
 
00db10
 static const char *command;