Do the TLS offset allocations before relocations, as otherwise there
can be overlap in the TLS offsets, if the relocations are done in a certain order. Approved by: dfr, grehan (mentor)
This commit is contained in:
parent
310814ced9
commit
5bbd22ee8d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=137121
@ -390,6 +390,17 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
||||
exit (0);
|
||||
}
|
||||
|
||||
/* setup TLS for main thread */
|
||||
dbg("initializing initial thread local storage");
|
||||
STAILQ_FOREACH(entry, &list_main, link) {
|
||||
/*
|
||||
* Allocate all the initial objects out of the static TLS
|
||||
* block even if they didn't ask for it.
|
||||
*/
|
||||
allocate_tls_offset(entry->obj);
|
||||
}
|
||||
allocate_initial_tls(obj_list);
|
||||
|
||||
if (relocate_objects(obj_main,
|
||||
ld_bind_now != NULL && *ld_bind_now != '\0', &obj_rtld) == -1)
|
||||
die();
|
||||
@ -410,17 +421,6 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
||||
dbg("initializing thread locks");
|
||||
lockdflt_init();
|
||||
|
||||
/* setup TLS for main thread */
|
||||
dbg("initializing initial thread local storage");
|
||||
STAILQ_FOREACH(entry, &list_main, link) {
|
||||
/*
|
||||
* Allocate all the initial objects out of the static TLS
|
||||
* block even if they didn't ask for it.
|
||||
*/
|
||||
allocate_tls_offset(entry->obj);
|
||||
}
|
||||
allocate_initial_tls(obj_list);
|
||||
|
||||
/* Make a list of init functions to call. */
|
||||
objlist_init(&initlist);
|
||||
initlist_add_objects(obj_list, preload_tail, &initlist);
|
||||
|
Loading…
Reference in New Issue
Block a user