HomeFreeBSD

libc: Use variables more consistent with Variant I for Variant II TLS

Description

libc: Use variables more consistent with Variant I for Variant II TLS

Firstly, the first argument to __libc_allocate_tls is the old TCB
(versus oldtls, which has less of a clear meaning), so rename it to
oldtcb like Variant I.

Secondly, segbase and oldsegbase are oriented towards what ends up in
the segment registers, but that's not the main concern here, and those
don't convey what they actually point to. Instead, rename segbase to tcb
and change it to a uintptr_t **, and remove oldsegbase as it's always
equal to oldtcb, again both matching Variant I.

Finally, rename tls to tls_block, and add back a (different) tls
variable rather than constantly recomputing tcb - libc_tls_static_space,
again both matching Variant I.

Whilst here, similarly fix the oldtls argument to be oldtcb in the PIC
__libc_allocate_tls stub.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D50227

Details

Provenance
jrtc27Authored on May 7 2025, 7:20 PM
Reviewer
kib
Differential Revision
D50227: libc: Use variables more consistent with Variant I for Variant II TLS
Parents
rG4642b638a522: rtld-elf: Consistently use uintptr_t for TLS implementation
Branches
Unknown
Tags
Unknown