Cleanup and retool portions of the TLS support and make sure that
authorMatthew Dillon <dillon@dragonflybsd.org>
Mon, 28 Mar 2005 03:33:20 +0000 (03:33 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Mon, 28 Mar 2005 03:33:20 +0000 (03:33 +0000)
commitbc633d631d552c37d0e3a5c21b317af07ac9507b
tree751e5778fd69bf6c00a849edc878cec15d88f057
parentabeb5df0360719b46f5e98aa930095afa0f97841
Cleanup and retool portions of the TLS support and make sure that
non-threaded binaries remain compatible with older kernels.

* Removes the tcb alignment argument.  Instead an alignment #define is
  placed in sys/tls.h

* Gets rid of the Variant I code (we can add it in later, it just gets
  in the way).

* Retools the Variant II code to support %gs:OFFSET (negative offset)
  AND %gs:0 relative accesses, supporting both -mtls-direct-seg-refs and
  -mno-tls-direct-seg-refs.

* Changes the Elf_Addr array for the TCB into a real structure in
  sys/tls.h

* Retains the DTV methodology.

* Retains the TCB methodology, but note that the area 'after' the tcb
  is now available for future use (at least with Variant I removed).
  Frankly I'm not sure we would ever want to support having the
  'data' area after the TCB instead of before the TCB, at least not
  for i386.

* Do not try to call sys_set_tls_area() if there is no TLS storage.
  i.e. so non-threaded binaries remain compatible with old kernels.

  The TLS is only initialized if (a) There is thread local storage, aka
  gcc3's __thread keyword, or (b) The program is linked against a threading
  library.  The threading library makes the appropriate calls to set up the
  TLS.
lib/libc/gen/tls.c
lib/libthread_xu/arch/amd64/amd64/pthread_md.c
lib/libthread_xu/arch/i386/i386/pthread_md.c
libexec/rtld-elf/i386/reloc.c
libexec/rtld-elf/rtld.c
libexec/rtld-elf/rtld.h
libexec/rtld-elf/rtld_tls.h
sys/sys/tls.h