diff options
author | ssouhlal <ssouhlal@FreeBSD.org> | 2004-11-02 09:42:21 +0000 |
---|---|---|
committer | ssouhlal <ssouhlal@FreeBSD.org> | 2004-11-02 09:42:21 +0000 |
commit | d6dc36dcc0920420394e02e5b7c7f81c949b1c22 (patch) | |
tree | b69d7e0fc2f1380a7be2b1ab780f469fa83b923a | |
parent | f4ccdfbd97020dc4b4cc8893a9924b86dddbdb17 (diff) | |
download | FreeBSD-src-d6dc36dcc0920420394e02e5b7c7f81c949b1c22.zip FreeBSD-src-d6dc36dcc0920420394e02e5b7c7f81c949b1c22.tar.gz |
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)
-rw-r--r-- | libexec/rtld-elf/rtld.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 5740e91..2741c13 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -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); |