Include <sys/tls.h> for:
- struct tls_tcb - thread control block structure
- HAVE_LWP_GETTCB_FAST - __lwp_gettcb_fast() is available
- HAVE_LWP_GETPRIVATE_FAST - __lwp_getprivate_fast() is available
- __HAVE_TLS_VARIANT_I - TLS Variant I for this architecture
- __HAVE_TLS_VARIANT_II - TLS Variant II for this architecture
Rename ThreadSelfSegbase() to ThreadSelfTlsTcb and switch it
to retrieve in a portable way TCB.
Switch ThreadSelf() to retrieve pthread from struct tcb_tls.
Use dl_iterate_phdr() to find out the size of TLS block of
the main program.
Correct the index of the TLS block of the main program
(dlpi_tls_modid); it's 1, not 2.
New NetBSD code is now CPU (NetBSD port) agnostic.
Stop sharing the same code with FreeBSD.
Sponsored by <The NetBSD Foundation>