about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/errno.h28
-rw-r--r--include/features.h16
-rw-r--r--include/gnu/stubs.h2
-rw-r--r--include/link.h3
-rw-r--r--include/netdb.h2
-rw-r--r--include/resolv.h2
-rw-r--r--include/shlib-compat.h13
-rw-r--r--include/stubs-prologue.h14
-rw-r--r--include/tls.h14
9 files changed, 69 insertions, 25 deletions
diff --git a/include/errno.h b/include/errno.h
index e9add9196a..eed947fd30 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -4,16 +4,34 @@
 
 #if defined _ERRNO_H && !defined _ISOMAC
 
-# include <tls.h>		/* Defines USE_TLS.  */
+# ifdef IS_IN_rtld
+#  include <dl-sysdep.h>
+# endif
+
+# if RTLD_PRIVATE_ERRNO
+/* The dynamic linker uses its own private errno variable.
+   All access to errno inside the dynamic linker is serialized,
+   so a single (hidden) global variable is all it needs.  */
 
-# if USE_TLS && HAVE___THREAD && (!defined NOT_IN_libc || defined IS_IN_rtld)
 #  undef  errno
 #  define errno errno		/* For #ifndef errno tests.  */
-extern __thread int errno;
+extern int errno attribute_hidden;
 #  define __set_errno(val) (errno = (val))
+
 # else
-#  define __set_errno(val) (*__errno_location ()) = (val)
-# endif
+
+#  include <tls.h>		/* Defines USE_TLS.  */
+
+#  if USE___THREAD
+#   undef  errno
+#   define errno errno		/* For #ifndef errno tests.  */
+extern __thread int errno;
+#   define __set_errno(val) (errno = (val))
+#  else
+#   define __set_errno(val) (*__errno_location ()) = (val)
+#  endif
+
+# endif	/* RTLD_PRIVATE_ERRNO */
 
 #endif /* _ERRNO_H */
 
diff --git a/include/features.h b/include/features.h
index fb7925c01c..366fcc5c6d 100644
--- a/include/features.h
+++ b/include/features.h
@@ -306,18 +306,12 @@
 # define __USE_EXTERN_INLINES	1
 #endif
 
-/* This is here only because every header file already includes this one.  */
-#ifndef _LIBC
-/* Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
-   <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
-   which will always return failure (and set errno to ENOSYS).
 
-   We avoid including <gnu/stubs.h> when compiling the C library itself to
-   avoid a dependency loop.  stubs.h depends on every object file.  If
-   this #include were done for the library source code, then every object
-   file would depend on stubs.h.  */
+/* This is here only because every header file already includes this one.
+   Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
+   <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
+   that will always return failure (and set errno to ENOSYS).  */
+#include <gnu/stubs.h>
 
-# include <gnu/stubs.h>
-#endif
 
 #endif	/* features.h  */
diff --git a/include/gnu/stubs.h b/include/gnu/stubs.h
new file mode 100644
index 0000000000..6308e4e0e0
--- /dev/null
+++ b/include/gnu/stubs.h
@@ -0,0 +1,2 @@
+/* This is a placeholder used only while compiling libc.
+   The installed gnu/stubs.h file is created by make install.  */
diff --git a/include/link.h b/include/link.h
index 9c8be662cd..ad4e0a4e0c 100644
--- a/include/link.h
+++ b/include/link.h
@@ -272,9 +272,6 @@ struct link_map
     ptrdiff_t l_tls_offset;
     /* Index of the module in the dtv array.  */
     size_t l_tls_modid;
-    /* Nonzero if the thread pointer (register or whatever it is) got
-       initialized.  */
-    int l_tls_tp_initialized;
 #endif
   };
 
diff --git a/include/netdb.h b/include/netdb.h
index d58fe5beda..423d5b496d 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -4,7 +4,7 @@
 /* Macros for accessing h_errno from inside libc.  */
 # ifdef _LIBC_REENTRANT
 #  include <tls.h>
-#  if USE_TLS && HAVE___THREAD
+#  if USE___THREAD
 #   undef  h_errno
 #   define h_errno h_errno	/* For #ifndef h_errno tests.  */
 extern __thread int h_errno;
diff --git a/include/resolv.h b/include/resolv.h
index b9ed35e977..2a4037c9c3 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -14,7 +14,7 @@
 
 # ifdef _LIBC_REENTRANT
 #  include <tls.h>
-#  if USE_TLS && HAVE___THREAD
+#  if USE___THREAD
 #   undef _res
 extern __thread struct __res_state _res;
 #  endif
diff --git a/include/shlib-compat.h b/include/shlib-compat.h
index 245b8aa89e..1e6d1782d9 100644
--- a/include/shlib-compat.h
+++ b/include/shlib-compat.h
@@ -1,5 +1,5 @@
 /* Macros for managing ABI-compatibility definitions using ELF symbol versions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -43,9 +43,14 @@
    e.g. `#if SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_2)' for code introduced
    in the GLIBC_2.0 version and obsoleted in the GLIBC_2.2 version.  */
 
-# define SHLIB_COMPAT(lib, introduced, obsoleted) \
-  (!(ABI_##lib##_##obsoleted - 0) \
-   || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0)))
+# define SHLIB_COMPAT(lib, introduced, obsoleted)			      \
+  ((IS_IN_##lib - 0)							      \
+   && (!(ABI_##lib##_##obsoleted - 0)					      \
+       || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0))))
+
+# ifndef NOT_IN_libc
+#  define IS_IN_libc 1
+# endif
 
 /* That header also defines symbols like `VERSION_libm_GLIBC_2_1' to
    the version set name to use for e.g. symbols first introduced into
diff --git a/include/stubs-prologue.h b/include/stubs-prologue.h
new file mode 100644
index 0000000000..0577bc6a5f
--- /dev/null
+++ b/include/stubs-prologue.h
@@ -0,0 +1,14 @@
+@ These lines with @ are omitted from the generated output.
+@ This file gives the initial contents of gnu/stubs.h, to which
+@ all the #define __stub_foo lines get appended by the makefile rule.
+@
+/* This file is automatically generated.
+   It defines a symbol `__stub_FUNCTION' for each function
+   in the C library which is a stub, meaning it will fail
+   every time called, usually setting errno to ENOSYS.  */
+
+#ifdef _LIBC
+ #error Applications may not define the macro _LIBC
+#endif
+
+@ Placeholder line so we remember to keep the preceding blank line here.
diff --git a/include/tls.h b/include/tls.h
new file mode 100644
index 0000000000..2e20a45582
--- /dev/null
+++ b/include/tls.h
@@ -0,0 +1,14 @@
+/* This file defines USE___THREAD to 1 or 0 to cut down on the #if mess.  */
+
+#include_next <tls.h>
+
+#if USE_TLS && HAVE___THREAD \
+    && (!defined NOT_IN_libc || defined IS_IN_libpthread)
+
+# define USE___THREAD 1
+
+#else
+
+# define USE___THREAD 0
+
+#endif