aboutsummaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-04-05 03:29:47 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-04-09 20:46:24 +0000
commitca46b5698e8ac38ab45d781d592700be59e7de97 (patch)
tree691cc6e76f3f31a23139d709af839438beff19e9 /lib/libc
parent06d8a116bd6b6f70b8aedc6a6a2c4085c53f63ac (diff)
downloadsrc-ca46b5698e8ac38ab45d781d592700be59e7de97.tar.gz
src-ca46b5698e8ac38ab45d781d592700be59e7de97.zip
libc: implement __tls_get_addr() for static binaries
Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/tls.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c
index 2a64b5266f4a..69b87aea52bf 100644
--- a/lib/libc/gen/tls.c
+++ b/lib/libc/gen/tls.c
@@ -103,25 +103,32 @@ static size_t libc_tls_init_align;
static void *libc_tls_init;
#endif
+void *
+__libc_tls_get_addr(void *vti)
+{
+ Elf_Addr **dtvp, *dtv;
+ tls_index *ti;
+
+ dtvp = _get_tp();
+ dtv = *dtvp;
+ ti = vti;
+ return ((char *)(dtv[ti->ti_module + 1] + ti->ti_offset) +
+ TLS_DTV_OFFSET);
+}
+
#ifdef __i386__
/* GNU ABI */
__attribute__((__regparm__(1)))
void *
-___libc_tls_get_addr(void *ti __unused)
+___libc_tls_get_addr(void *vti)
{
- return (0);
+ return (__libc_tls_get_addr(vti));
}
#endif
-void *
-__libc_tls_get_addr(void *ti __unused)
-{
- return (0);
-}
-
#ifndef PIC
static void *