Allocate space for thread pointer, this allows thread library to access
its pointer from begin, and simplifies _get_curthread() in libthr.
This commit is contained in:
parent
20df0de426
commit
c0d2338cdd
@ -131,7 +131,7 @@ __libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign __unused)
|
||||
if (size < tcbsize)
|
||||
size = tcbsize;
|
||||
|
||||
tls = malloc(size);
|
||||
tls = calloc(1, size);
|
||||
dtv = malloc(3 * sizeof(Elf_Addr));
|
||||
|
||||
*(Elf_Addr **) tls = dtv;
|
||||
@ -202,7 +202,7 @@ __libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign)
|
||||
size = round(tls_static_space, tcbalign);
|
||||
|
||||
assert(tcbsize >= 2*sizeof(Elf_Addr));
|
||||
tls = malloc(size + tcbsize);
|
||||
tls = calloc(1, size + tcbsize);
|
||||
dtv = malloc(3 * sizeof(Elf_Addr));
|
||||
|
||||
segbase = (Elf_Addr)(tls + size);
|
||||
@ -309,7 +309,7 @@ _init_tls()
|
||||
}
|
||||
}
|
||||
|
||||
tls = _rtld_allocate_tls(NULL, 2*sizeof(Elf_Addr),
|
||||
tls = _rtld_allocate_tls(NULL, 3*sizeof(Elf_Addr),
|
||||
sizeof(Elf_Addr));
|
||||
|
||||
_set_tp(tls);
|
||||
|
@ -384,7 +384,7 @@ allocate_initial_tls(Obj_Entry *objs)
|
||||
*/
|
||||
tls_static_space = tls_last_offset + RTLD_STATIC_TLS_EXTRA;
|
||||
amd64_set_fsbase(allocate_tls(objs, 0,
|
||||
2*sizeof(Elf_Addr), sizeof(Elf_Addr)));
|
||||
3*sizeof(Elf_Addr), sizeof(Elf_Addr)));
|
||||
}
|
||||
|
||||
void *__tls_get_addr(tls_index *ti)
|
||||
|
@ -336,7 +336,7 @@ allocate_initial_tls(Obj_Entry *objs)
|
||||
* use.
|
||||
*/
|
||||
tls_static_space = tls_last_offset + RTLD_STATIC_TLS_EXTRA;
|
||||
tls = allocate_tls(objs, NULL, 2*sizeof(Elf_Addr), sizeof(Elf_Addr));
|
||||
tls = allocate_tls(objs, NULL, 3*sizeof(Elf_Addr), sizeof(Elf_Addr));
|
||||
i386_set_gsbase(tls);
|
||||
}
|
||||
|
||||
|
@ -2707,7 +2707,7 @@ allocate_tls(Obj_Entry *objs, void *oldtls, size_t tcbsize, size_t tcbalign)
|
||||
|
||||
size = tls_static_space;
|
||||
|
||||
tls = malloc(size);
|
||||
tls = calloc(1, size);
|
||||
dtv = calloc(1, (tls_max_index + 2) * sizeof(Elf_Addr));
|
||||
|
||||
*(Elf_Addr**) tls = dtv;
|
||||
|
@ -731,7 +731,7 @@ allocate_initial_tls(Obj_Entry *objs)
|
||||
* use.
|
||||
*/
|
||||
tls_static_space = tls_last_offset + RTLD_STATIC_TLS_EXTRA;
|
||||
tp = allocate_tls(objs, NULL, 2*sizeof(Elf_Addr), sizeof(Elf_Addr));
|
||||
tp = allocate_tls(objs, NULL, 3*sizeof(Elf_Addr), sizeof(Elf_Addr));
|
||||
}
|
||||
|
||||
void *__tls_get_addr(tls_index *ti)
|
||||
|
Loading…
x
Reference in New Issue
Block a user