HomeFreeBSD

libc, libthr: Ditch MD __pthread_distribute_static_tls helpers

Description

libc, libthr: Ditch MD __pthread_distribute_static_tls helpers

_libc_get_static_tls_base() is just _tcb_get() followed by adding (for
Variant I) or subtracting (for Variant II) the offset, so just inline
that as the implementation (like we do in rtld-elf) rather than having
another copy (or equivalent) of _tcb_get()'s assembly.

_get_static_tls_base() doesn't even have any MD assembly as it's
reading thr->tcb, the only difference is whether to add or subtract, so
again just inline that.

Whilst here add some missing blank lines to comply with style(9) for
elf_utils.c's includes, and use a pointer type rather than uintptr_t to
reduce the need to cast, as is done in rtld-elf.

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

Details

Provenance
jrtc27Authored on May 29 2025, 4:06 PM
Reviewer
kib
Differential Revision
D50592: libc, libthr: Ditch MD __pthread_distribute_static_tls helpers
Parents
rG960f40b892cf: rtld-elf: Pass struct tcb * around rather than struct dtv **
Branches
Unknown
Tags
Unknown