git: c4ec1f6efb52 - stable/13 - libthr: Use TLS_TCB_* in _tcb_[cd]tor.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 29 Apr 2022 23:12:37 UTC
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=c4ec1f6efb52cd311b969d0a2018ca875c40f5e9

commit c4ec1f6efb52cd311b969d0a2018ca875c40f5e9
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-01-25 19:38:34 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-04-29 23:05:18 +0000

    libthr: Use TLS_TCB_* in _tcb_[cd]tor.
    
    This matches libc and rtld in using the alignment (TLS_TCB_ALIGN) from
    machine/tls.h instead of hardcoding 16.
    
    Reviewed by:    kib
    Sponsored by:   The University of Cambridge, Google Inc.
    Differential Revision:  https://reviews.freebsd.org/D34023
    
    (cherry picked from commit 8de1a8131e42f96f8dcfbca9073896d249ff7d2c)
---
 lib/libthr/thread/thr_ctrdtr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/libthr/thread/thr_ctrdtr.c b/lib/libthr/thread/thr_ctrdtr.c
index 9d4301ef719f..9ce068072524 100644
--- a/lib/libthr/thread/thr_ctrdtr.c
+++ b/lib/libthr/thread/thr_ctrdtr.c
@@ -42,7 +42,7 @@ _tcb_ctor(struct pthread *thread, int initial)
 	if (initial)
 		tcb = _tcb_get();
 	else
-		tcb = _rtld_allocate_tls(NULL, sizeof(struct tcb), 16);
+		tcb = _rtld_allocate_tls(NULL, TLS_TCB_SIZE, TLS_TCB_ALIGN);
 	if (tcb)
 		tcb->tcb_thread = thread;
 	return (tcb);
@@ -52,5 +52,5 @@ void
 _tcb_dtor(struct tcb *tcb)
 {
 
-	_rtld_free_tls(tcb, sizeof(struct tcb), 16);
+	_rtld_free_tls(tcb, TLS_TCB_SIZE, TLS_TCB_ALIGN);
 }