Major TLS cleanups.
authorMatthew Dillon <dillon@dragonflybsd.org>
Wed, 11 May 2005 19:47:09 +0000 (19:47 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Wed, 11 May 2005 19:47:09 +0000 (19:47 +0000)
commita1eee96a9ec31b34bf52c63e2eeffb68f7904b18
tree7b4fce456ab6eaeb1f806dfd415c90dd98c85a47
parent9bf3a1b2d560bb0243d84e4ae3d9605a02b166ab
Major TLS cleanups.

* The RTLD no longer attempts to set up an initial TLS.  The job has been
  moved to libc.  The RTLD does not use TLS itself.  The
  allocate_initial_tls() function has been removed.

* The _init_tls() call made by CRT1 is no mandatory.

* The RTLD no longer calls the library _init() functions early.  Instead it
  sets up a callback that allows CRT1 to call the library _init() functions
  after it has called _init_tls().

* LIBC now has a _libc_init_tls() function which is weakly bound as
  _init_tls().  This function initializes the TLS for the program (generally
  by calling the _rtld_allocate_tls() and then doing any required
  post-allocation initialization).  In the absence of a threading library
  this function is basically it.

  Threading libraries may replace _init_tls() with their own version.  This
  does not yet occur as of this commit.  The threading library would then
  almost certainly call _libc_init_tls() and then make further modifications
  to the TCB as necessary (e.g. populate the tcb_pthread field).

* RTLD's allocate_tls() no longer does anything fancy.  The 'old_tcb' argument
  and concept has been removed.

* We have a new tcb_errno_p field in the TCB, but as of this commit it
  is not yet being used.

Reviewed-by: Joerg Sonnenberger <joerg@britannica.bec.de>,
David Xu <davidxu@crater.dragonflybsd.org>
19 files changed:
gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h
gnu/usr.bin/cc34/cc_prep/config/i386/dragonfly.h
lib/csu/i386/crt1.c
lib/libc/gen/tls.c
lib/libc/i386/sys/cerror.S
lib/libc/include/libc_private.h
lib/libc_r/uthread/uthread_create.c
lib/libc_r/uthread/uthread_init.c
lib/libthread_xu/arch/amd64/amd64/pthread_md.c
lib/libthread_xu/arch/i386/i386/pthread_md.c
libexec/rtld-elf/Makefile
libexec/rtld-elf/debug.h
libexec/rtld-elf/i386/reloc.c
libexec/rtld-elf/i386/rtld_machdep.h
libexec/rtld-elf/rtld.1
libexec/rtld-elf/rtld.c
libexec/rtld-elf/rtld.h
sys/cpu/i386/include/tls.h
sys/i386/include/tls.h