]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
TLS: Use <machine/tls.h> for libc and rtld.
authorJohn Baldwin <jhb@FreeBSD.org>
Thu, 9 Dec 2021 21:17:54 +0000 (13:17 -0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Fri, 29 Apr 2022 20:50:05 +0000 (13:50 -0700)
commita641444939d170dfa803fca75d92655c2bf28244
tree758c00ed259759850adf03ef1114daa196210d91
parent34e70df37ae70c54d9f87ce1267da0c9a72e662c
TLS: Use <machine/tls.h> for libc and rtld.

- Include <machine/tls.h> in MD rtld_machdep.h headers.

- Remove local definitions of TLS_* constants from rtld_machdep.h
  headers and libc using the values from <machine/tls.h> instead.

- Use _tcb_set() instead of inlined versions in MD
  allocate_initial_tls() routines in rtld.  The one exception is amd64
  whose _tcb_set() invokes the amd64_set_fsbase ifunc.  rtld cannot
  use ifuncs, so amd64 inlines the logic to optionally write to fsbase
  directly.

- Use _tcb_set() instead of _set_tp() in libc.

- Use '&_tcb_get()->tcb_dtv' instead of _get_tp() in both rtld and libc.
  This permits removing _get_tp.c from rtld.

- Use TLS_TCB_SIZE and TLS_TCB_ALIGN with allocate_tls() in MD
  allocate_initial_tls() routines in rtld.

Reviewed by: kib, jrtc27 (earlier version)
Differential Revision: https://reviews.freebsd.org/D33353

(cherry picked from commit 8bcdb144ebe391ce243c71caf06cf417d96ce335)
20 files changed:
lib/libc/gen/tls.c
libexec/rtld-elf/aarch64/reloc.c
libexec/rtld-elf/aarch64/rtld_machdep.h
libexec/rtld-elf/amd64/reloc.c
libexec/rtld-elf/amd64/rtld_machdep.h
libexec/rtld-elf/arm/reloc.c
libexec/rtld-elf/arm/rtld_machdep.h
libexec/rtld-elf/i386/reloc.c
libexec/rtld-elf/i386/rtld_machdep.h
libexec/rtld-elf/mips/reloc.c
libexec/rtld-elf/mips/rtld_machdep.h
libexec/rtld-elf/powerpc/reloc.c
libexec/rtld-elf/powerpc/rtld_machdep.h
libexec/rtld-elf/powerpc64/reloc.c
libexec/rtld-elf/powerpc64/rtld_machdep.h
libexec/rtld-elf/riscv/reloc.c
libexec/rtld-elf/riscv/rtld_machdep.h
libexec/rtld-elf/rtld-libc/Makefile.inc
libexec/rtld-elf/rtld.c
libexec/rtld-elf/rtld.h