libc,libthr: Remove __pthread_distribute_static_tls

This private API is no longer used by rtld-elf so can be removed.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D50921
This commit is contained in:
Jessica Clarke 2025-07-10 20:00:28 +01:00
parent a1d971ad3f
commit 2c444fdb0c
7 changed files with 1 additions and 72 deletions

View file

@ -596,7 +596,6 @@ FBSDprivate_1.0 {
__libc_tcdrain;
__pthread_distribute_static_tls;
__pthread_map_stacks_exec;
__fillcontextx;
__fillcontextx2;

View file

@ -41,7 +41,6 @@
#include "libc_private.h"
void __pthread_map_stacks_exec(void);
void __pthread_distribute_static_tls(size_t, void *, size_t, size_t);
int
__elf_phdr_match_addr(struct dl_phdr_info *phdr_info, void *addr)
@ -105,28 +104,3 @@ __pthread_map_stacks_exec(void)
((void (*)(void))__libc_interposing[INTERPOS_map_stacks_exec])();
}
void
__libc_distribute_static_tls(size_t offset, void *src, size_t len,
size_t total_len)
{
char *tlsbase;
#ifdef TLS_VARIANT_I
tlsbase = (char *)_tcb_get() + offset;
#else
tlsbase = (char *)_tcb_get() - offset;
#endif
memcpy(tlsbase, src, len);
memset(tlsbase + len, 0, total_len - len);
}
#pragma weak __pthread_distribute_static_tls
void
__pthread_distribute_static_tls(size_t offset, void *src, size_t len,
size_t total_len)
{
((void (*)(size_t, void *, size_t, size_t))__libc_interposing[
INTERPOS_distribute_static_tls])(offset, src, len, total_len);
}

View file

@ -42,7 +42,6 @@ interpos_func_t __libc_interposing[INTERPOS_MAX] = {
SLOT(spinlock, __libc_spinlock_stub),
SLOT(spinunlock, __libc_spinunlock_stub),
SLOT(map_stacks_exec, __libc_map_stacks_exec),
SLOT(distribute_static_tls, __libc_distribute_static_tls),
SLOT(uexterr_gettext, __libc_uexterr_gettext),
};
#undef SLOT

View file

@ -249,7 +249,7 @@ enum {
INTERPOS_map_stacks_exec,
INTERPOS_fdatasync,
INTERPOS_clock_nanosleep,
INTERPOS_distribute_static_tls,
INTERPOS__reserved0, /* was distribute_static_tls */
INTERPOS_pdfork,
INTERPOS_uexterr_gettext,
INTERPOS_MAX
@ -361,8 +361,6 @@ struct dl_phdr_info;
int __elf_phdr_match_addr(struct dl_phdr_info *, void *);
void __init_elf_aux_vector(void);
void __libc_map_stacks_exec(void);
void __libc_distribute_static_tls(__size_t, void *, __size_t, __size_t);
__uintptr_t __libc_static_tls_base(__size_t);
void _pthread_cancel_enter(int);
void _pthread_cancel_leave(int);

View file

@ -136,7 +136,6 @@ FBSDprivate_1.0 {
__pthread_mutex_lock;
__pthread_mutex_timedlock;
__pthread_mutex_trylock;
__pthread_distribute_static_tls;
_pthread_atfork;
_pthread_barrier_destroy;
_pthread_barrier_init;

View file

@ -363,41 +363,3 @@ _thr_find_thread(struct pthread *curthread, struct pthread *thread,
THREAD_LIST_UNLOCK(curthread);
return (ret);
}
static void
thr_distribute_static_tls(char *tlsbase, void *src, size_t len,
size_t total_len)
{
memcpy(tlsbase, src, len);
memset(tlsbase + len, 0, total_len - len);
}
void
__pthread_distribute_static_tls(size_t offset, void *src, size_t len,
size_t total_len)
{
struct pthread *curthread, *thrd;
char *tlsbase;
if (!_thr_is_inited()) {
#ifdef TLS_VARIANT_I
tlsbase = (char *)_tcb_get() + offset;
#else
tlsbase = (char *)_tcb_get() - offset;
#endif
thr_distribute_static_tls(tlsbase, src, len, total_len);
return;
}
curthread = _get_curthread();
THREAD_LIST_RDLOCK(curthread);
TAILQ_FOREACH(thrd, &_thread_list, tle) {
#ifdef TLS_VARIANT_I
tlsbase = (char *)thrd->tcb + offset;
#else
tlsbase = (char *)thrd->tcb - offset;
#endif
thr_distribute_static_tls(tlsbase, src, len, total_len);
}
THREAD_LIST_UNLOCK(curthread);
}

View file

@ -986,8 +986,6 @@ void __pthread_cxa_finalize(struct dl_phdr_info *phdr_info);
void _thr_tsd_unload(struct dl_phdr_info *phdr_info) __hidden;
void _thr_sigact_unload(struct dl_phdr_info *phdr_info) __hidden;
void _thr_stack_fix_protection(struct pthread *thrd);
void __pthread_distribute_static_tls(size_t offset, void *src, size_t len,
size_t total_len);
int *__error_threaded(void) __hidden;
void __thr_interpose_libc(void) __hidden;