Postpone the resolution of IRELATIVE relocations and IFUNC-targeted

relocations until tls is initialized and stacks permissions correctly
set. This allows the ifunc to call malloc(3) and some other heavy
services.

Add debug banner.

MFC after:	3 days
This commit is contained in:
Konstantin Belousov 2012-01-04 17:17:11 +00:00
parent 3079d69f90
commit 68266d5aba
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=229508

View File

@ -515,10 +515,6 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
ld_bind_now != NULL && *ld_bind_now != '\0', &obj_rtld, NULL) == -1)
die();
if (resolve_objects_ifunc(obj_main,
ld_bind_now != NULL && *ld_bind_now != '\0', NULL) == -1)
die();
dbg("doing copy relocations");
if (do_copy_relocations(obj_main) == -1)
die();
@ -549,6 +545,11 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
map_stacks_exec(NULL);
dbg("resolving ifuncs");
if (resolve_objects_ifunc(obj_main,
ld_bind_now != NULL && *ld_bind_now != '\0', NULL) == -1)
die();
wlock_acquire(rtld_bind_lock, &lockstate);
objlist_call_init(&initlist, &lockstate);
objlist_clear(&initlist);