aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-08-15 02:14:26 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-08-16 10:55:35 +0000
commit300e08933e80e9fce02d0d2f7a64e3ad27e4ce8e (patch)
tree95bf99db5c6a43b0d64e6d7c0af05d8eb23df460 /lib
parent8f63fa78e84afd23fa68c82eabfe64763c92d4f5 (diff)
downloadsrc-300e08933e80e9fce02d0d2f7a64e3ad27e4ce8e.tar.gz
src-300e08933e80e9fce02d0d2f7a64e3ad27e4ce8e.zip
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
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/tls.c10
1 files 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);