diff options
author | Kurt Miller <kurt@cvs.openbsd.org> | 2008-05-05 02:29:03 +0000 |
---|---|---|
committer | Kurt Miller <kurt@cvs.openbsd.org> | 2008-05-05 02:29:03 +0000 |
commit | ad4c4a19f3244639fc47e7c3f573d916bb887d76 (patch) | |
tree | 7d146f91b712efe1f36bdc997c66c8517d8dbe06 /libexec/ld.so/loader.c | |
parent | d99b64f3f763942797bb5d8c17c19e084487877d (diff) |
Constantly fill in the program header pointer and count in elf_object_t
for all objects which simplifies phdr usage in a few places.
"go for it" drahn@
Diffstat (limited to 'libexec/ld.so/loader.c')
-rw-r--r-- | libexec/ld.so/loader.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index c8d38594880..50d49a8df05 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.112 2007/11/27 16:42:15 miod Exp $ */ +/* $OpenBSD: loader.c,v 1.113 2008/05/05 02:29:02 kurt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -362,6 +362,7 @@ _dl_boot(const char **argv, char **envp, const long loff, long *dl_data) struct load_list *next_load, *load_list = NULL; Elf_Dyn *dynp; Elf_Phdr *phdp; + Elf_Ehdr *ehdr; char *us = ""; unsigned int loop; int failed; @@ -417,8 +418,8 @@ _dl_boot(const char **argv, char **envp, const long loff, long *dl_data) for (loop = 0; loop < dl_data[AUX_phnum]; loop++) { if (phdp->p_type == PT_DYNAMIC) { exe_obj = _dl_finalize_object(argv[0] ? argv[0] : "", - (Elf_Dyn *)phdp->p_vaddr, dl_data, OBJTYPE_EXE, - 0, 0); + (Elf_Dyn *)phdp->p_vaddr, (Elf_Phdr *)dl_data[AUX_phdr], + dl_data[AUX_phnum], OBJTYPE_EXE, 0, 0); _dl_add_object(exe_obj); } else if (phdp->p_type == PT_INTERP) { us = _dl_strdup((char *)phdp->p_vaddr); @@ -463,8 +464,10 @@ _dl_boot(const char **argv, char **envp, const long loff, long *dl_data) * Intentionally left off the exe child_list. */ dynp = (Elf_Dyn *)((void *)_DYNAMIC); - dyn_obj = _dl_finalize_object(us, dynp, 0, OBJTYPE_LDR, - dl_data[AUX_base], loff); + ehdr = (Elf_Ehdr *)dl_data[AUX_base]; + dyn_obj = _dl_finalize_object(us, dynp, + (Elf_Phdr *)((char *)dl_data[AUX_base] + ehdr->e_phoff), + ehdr->e_phnum, OBJTYPE_LDR, dl_data[AUX_base], loff); _dl_add_object(dyn_obj); dyn_obj->refcount++; |