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