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