aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/errno.h8
-rw-r--r--include/libc-symbols.h6
-rw-r--r--include/netdb.h8
-rw-r--r--include/resolv.h5
4 files changed, 22 insertions, 5 deletions
diff --git a/include/errno.h b/include/errno.h
index eed947fd30..1663538661 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -24,8 +24,12 @@ extern int errno attribute_hidden;
# if USE___THREAD
# undef errno
-# define errno errno /* For #ifndef errno tests. */
-extern __thread int errno;
+# ifndef NOT_IN_libc
+# define errno __libc_errno
+# else
+# define errno errno /* For #ifndef errno tests. */
+# endif
+extern __thread int errno attribute_tls_model_ie;
# define __set_errno(val) (errno = (val))
# else
# define __set_errno(val) (*__errno_location ()) = (val)
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index eb7b0dc321..69fe729d73 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -445,6 +445,12 @@
# define attribute_hidden
#endif
+#if defined HAVE_TLS_MODEL_ATTRIBUTE
+# define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
+#else
+# define attribute_tls_model_ie
+#endif
+
/* Handling on non-exported internal names. We have to do this only
for shared code. */
#ifdef SHARED
diff --git a/include/netdb.h b/include/netdb.h
index 423d5b496d..54cdda1eea 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -6,8 +6,12 @@
# include <tls.h>
# if USE___THREAD
# undef h_errno
-# define h_errno h_errno /* For #ifndef h_errno tests. */
-extern __thread int h_errno;
+# ifndef NOT_IN_libc
+# define h_errno __libc_h_errno
+# else
+# define h_errno h_errno /* For #ifndef h_errno tests. */
+# endif
+extern __thread int h_errno attribute_tls_model_ie;
# define __set_h_errno(x) (h_errno = (x))
# else
static inline int
diff --git a/include/resolv.h b/include/resolv.h
index 2a4037c9c3..12b4f744da 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -16,7 +16,10 @@
# include <tls.h>
# if USE___THREAD
# undef _res
-extern __thread struct __res_state _res;
+# ifndef NOT_IN_libc
+# define _res __libc_res
+# endif
+extern __thread struct __res_state _res attribute_tls_model_ie;
# endif
# else
# ifndef __BIND_NOSTATIC