diff options
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ld.so/loader.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index 21cc7b7137d..f8b621f63c5 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.107 2006/11/15 19:14:21 deraadt Exp $ */ +/* $OpenBSD: loader.c,v 1.108 2006/11/21 20:15:55 drahn 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) unsigned int loop; int failed; struct dep_node *n; + Elf_Addr start, end; _dl_setup_env(envp); @@ -406,6 +407,9 @@ _dl_boot(const char **argv, char **envp, const long loff, long *dl_data) exe_obj = NULL; _dl_loading_object = NULL; + + start = ELFDEFNNAME(NO_ADDR); + end = 0; /* * Examine the user application and set up object information. */ @@ -431,6 +435,10 @@ _dl_boot(const char **argv, char **envp, const long loff, long *dl_data) next_load->size = size; next_load->prot = PFLAGS(phdp->p_flags); + if (phdp->p_vaddr < start) + start = phdp->p_vaddr; + if (phdp->p_vaddr > end) + end = phdp->p_vaddr; if (phdp->p_flags & 0x08000000) { // dump_prelink(phdp->p_vaddr, phdp->p_memsz); prebind_load_exe(phdp, exe_obj); @@ -440,6 +448,10 @@ _dl_boot(const char **argv, char **envp, const long loff, long *dl_data) } exe_obj->load_list = load_list; exe_obj->obj_flags |= RTLD_GLOBAL; + if (start != ELFDEFNNAME(NO_ADDR)) { + exe_obj->load_addr = start; + exe_obj->load_size = end - start; + } n = _dl_malloc(sizeof *n); if (n == NULL) |