projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix x32 unistd macros to report as ILP32 not LP64
[musl]
/
src
/
env
/
__init_tls.c
diff --git
a/src/env/__init_tls.c
b/src/env/__init_tls.c
index
0107a54
..
b125eb1
100644
(file)
--- a/
src/env/__init_tls.c
+++ b/
src/env/__init_tls.c
@@
-71,6
+71,9
@@
typedef Elf32_Phdr Phdr;
typedef Elf64_Phdr Phdr;
#endif
typedef Elf64_Phdr Phdr;
#endif
+__attribute__((__weak__, __visibility__("hidden")))
+extern const size_t _DYNAMIC[];
+
static void static_init_tls(size_t *aux)
{
unsigned char *p;
static void static_init_tls(size_t *aux)
{
unsigned char *p;
@@
-83,6
+86,8
@@
static void static_init_tls(size_t *aux)
phdr = (void *)p;
if (phdr->p_type == PT_PHDR)
base = aux[AT_PHDR] - phdr->p_vaddr;
phdr = (void *)p;
if (phdr->p_type == PT_PHDR)
base = aux[AT_PHDR] - phdr->p_vaddr;
+ if (phdr->p_type == PT_DYNAMIC && _DYNAMIC)
+ base = (size_t)_DYNAMIC - phdr->p_vaddr;
if (phdr->p_type == PT_TLS)
tls_phdr = phdr;
}
if (phdr->p_type == PT_TLS)
tls_phdr = phdr;
}