git: 300e08933e80 - main - libc tls: use TLS_DTV_OFFSET defined by rtld.h
Konstantin Belousov
kib at FreeBSD.org
Mon Aug 16 10:56:17 UTC 2021
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=300e08933e80e9fce02d0d2f7a64e3ad27e4ce8e
commit 300e08933e80e9fce02d0d2f7a64e3ad27e4ce8e
Author: Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-08-15 02:14:26 +0000
Commit: Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-08-16 10:55:35 +0000
libc tls: use TLS_DTV_OFFSET defined by rtld.h
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31541
---
lib/libc/gen/tls.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c
index b5f5dfd4d315..d90aac028b88 100644
--- a/lib/libc/gen/tls.c
+++ b/lib/libc/gen/tls.c
@@ -81,12 +81,6 @@ void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign);
#error TLS_TCB_ALIGN undefined for target architecture
#endif
-#if defined(__mips__) || defined(__powerpc__) || defined(__riscv)
-#define DTV_OFFSET 0x8000
-#else
-#define DTV_OFFSET 0
-#endif
-
#ifndef PIC
static size_t libc_tls_static_space;
@@ -289,7 +283,7 @@ __libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign)
/* Adjust the DTV. */
dtv = tcb[0];
- dtv[2] = (Elf_Addr)(tls + DTV_OFFSET);
+ dtv[2] = (Elf_Addr)(tls + TLS_DTV_OFFSET);
} else {
dtv = __je_bootstrap_malloc(3 * sizeof(Elf_Addr));
if (dtv == NULL) {
@@ -300,7 +294,7 @@ __libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign)
tcb[0] = dtv;
dtv[0] = 1; /* Generation. */
dtv[1] = 1; /* Segments count. */
- dtv[2] = (Elf_Addr)(tls + DTV_OFFSET);
+ dtv[2] = (Elf_Addr)(tls + TLS_DTV_OFFSET);
if (libc_tls_init_size > 0)
memcpy(tls, libc_tls_init, libc_tls_init_size);
More information about the dev-commits-src-main
mailing list