summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-10-11 10:52:20 +0000
committerRoland McGrath <roland@gnu.org>2002-10-11 10:52:20 +0000
commitce460d04a5bd10d7353ca37dfa9d34275449fb3b (patch)
treee203d270a348ce6c5d0f4dbc54a430fbd106fd93 /include
parent28654d2a063d22fda1fd748f392876ed61c36fa0 (diff)
downloadglibc-ce460d04a5bd10d7353ca37dfa9d34275449fb3b.tar.gz
* sysdeps/generic/bits/libc-tsd.h [USE___THREAD]: Conditional
changed from [USE_TLS && HAVE___THREAD]. * sysdeps/i386/dl-machine.h (elf_machine_type_class, elf_machine_rel): Disable TLS relocs if [RTLD_BOOTSTRAP && !USE___THREAD]. * sysdeps/x86_64/dl-machine.h (elf_machine_type_class, elf_machine_rela): Likewise. * sysdeps/sh/dl-machine.h (elf_machine_type_class, elf_machine_rela): Likewise. * include/link.h (struct link_map): Remove member l_tls_tp_initialized. * elf/rtld.c (_dl_start_final, dl_main): Don't use it. (_dl_start): Conditionalize PT_TLS check on [USE___THREAD]. * sysdeps/i386/dl-tls.h (__TLS_GET_ADDR): Use ___tls_get_addr_internal instead of ___tls_get_addr. (___tls_get_addr_internal): Add attribute_hidden to decl. * sysdeps/generic/ldsodefs.h (struct rtld_global): New variable _dl_error_catch_tsd. * elf/rtld.c (startup_error_tsd): New function. (dl_main): Point _dl_error_catch_tsd at that. * elf/dl-error.c: Don't use libc-tsd.h for DL_ERROR, use new function pointer instead. * elf/dl-tsd.c: New file. * elf/Makefile (routines): Add it. 2002-10-07 Roland McGrath <roland@redhat.com> * elf/dl-misc.c (_dl_debug_vdprintf): Use INTERNAL_SYSCALL macro for writev if it's available. Otherwise if [RTLD_PRIVATE_ERRNO] then take _dl_load_lock around calling __writev. * sysdeps/unix/sysv/linux/i386/sysdep.h (INTERNAL_SYSCALL): New macro. (INLINE_SYSCALL): Use that. * sysdeps/generic/dl-sysdep.h: New file. * sysdeps/mach/hurd/dl-sysdep.h: New file. * sysdeps/generic/ldsodefs.h: Include <dl-sysdep.h>. * include/errno.h [IS_IN_rtld]: Include <dl-sysdep.h> to define ... [RTLD_PRIVATE_ERRNO]: Use a hidden global variable for errno and access it directly. * elf/dl-minimal.c (__errno_location): Removed. * sysdeps/unix/i386/sysdep.S (__syscall_errno) [RTLD_PRIVATE_ERRNO]: Use GOTOFF access for errno. * sysdeps/unix/sysv/linux/i386/sysdep.h [RTLD_PRIVATE_ERRNO] (SYSCALL_ERROR_HANDLER): Likewise. * sysdeps/unix/x86_64/sysdep.S (__syscall_errno) [RTLD_PRIVATE_ERRNO]: Use PC-relative access for errno. * sysdeps/unix/sysv/linux/x86_64/sysdep.h [RTLD_PRIVATE_ERRNO] (SYSCALL_ERROR_HANDLER): Likewise. * include/tls.h: New file. (USE___THREAD): New macro. Define to 1 under [USE_TLS && HAVE___THREAD] and only when compiling libc or libpthread. * sysdeps/unix/sysv/linux/i386/sysdep.h [USE___THREAD]: Conditional changed from [USE_TLS && HAVE___THREAD]. * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise. * sysdeps/unix/i386/sysdep.S: Likewise. * sysdeps/unix/x86_64/sysdep.S: Likewise. * include/errno.h: Likewise. * include/netdb.h: Likewise. * include/resolv.h: Likewise. * sysdeps/generic/errno.c: New file. * csu/Makefile (aux): New variable, list errno. * sysdeps/unix/sysv/linux/i386/sysdep.S (errno, _errno): Remove defns. * sysdeps/unix/sysv/linux/m68k/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/arm/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/cris/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep.c: Likewise. * sysdeps/unix/sysv/linux/ia64/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/sh/sysdep.S: Likewise. * sysdeps/unix/alpha/sysdep.S: Likewise. * sysdeps/generic/start.c: Likewise. * sysdeps/unix/start.c: Likewise. * sysdeps/unix/arm/start.c: Likewise. * sysdeps/unix/bsd/ultrix4/mips/start.S: Likewise. * sysdeps/unix/sparc/start.c: Likewise. * sysdeps/unix/sysv/irix4/start.c: Likewise. * sysdeps/unix/sysv/linux/mips/sysdep.S: File removed. * manual/search.texi (Tree Search Function, Hash Search Function): Mention search.h clearly. 2002-10-05 Roland McGrath <roland@redhat.com> * elf/dl-fxstat64.c: File removed. * elf/dl-xstat64.c: File removed. * elf/Makefile (rtld-routines): Remove them. * sysdeps/unix/sysv/linux/xstat64.c: Remove RTLD_STAT64 conditionals. Instead, use strong_alias instead of versioned_symbol in the !SHLIB_COMPAT case. * sysdeps/unix/sysv/linux/fxstat64.c: Likewise. * sysdeps/unix/sysv/linux/lxstat64.c: Likewise. * include/shlib-compat.h (SHLIB_COMPAT): Require that IS_IN_##lib be defined nonzero. [! NOT_IN_libc] (IS_IN_libc): Define it. * cppflags-iterator.mk (CPPFLAGS-$(cpp-src)): Use -Dx=1 not just -Dx. * elf/Makefile (CPPFLAGS-.os): Likewise. * sunrpc/rpc_main.c (main): Don't declare with noreturn attribute. Return the status instead of calling exit. * Makeconfig (CFLAGS): Prepend -std=gnu99. * Makerules (+make-deps): Use $(CFLAGS) only for .c sources. Remove superfluous rm command, whose @ plus make bugs hid all these commands from the make output. * include/stubs-prologue.h: New file. Give #error under #ifdef _LIBC. * Makefile ($(inst_includedir)/gnu/stubs.h): Depend on it. Use that file's contents instead of literal echo's for the prologue. * include/features.h: Include <gnu/stubs.h> unconditionally. * include/gnu/stubs.h: New file. 2002-09-30 Roland McGrath <roland@redhat.com> * elf/rtld-Rules: New file. * elf/Makefile ($(objpfx)librtld.map, $(objpfx)librtld.mk, $(objpfx)rtld-libc.a): New targets. (generated): Add them. (reloc-link): Remove -o $@ from the variable. ($(objpfx)dl-allobjs.os): Add -o $@ after $(reloc-link). (distribute): Add rtld-Rules. (CPPFLAGS-.os): Define this instead of CFLAGS-.os. * Makerules ($(+sysdir_pfx)sysd-rules): Emit rules for rtld-% targets. (common-mostlyclean, common-clean): Clean up rtld-* files. * sysdeps/unix/make-syscalls.sh: Add rtld-*.os target name to rules.
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