summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2006-11-21 20:15:56 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2006-11-21 20:15:56 +0000
commit019ac7bf6e4ed65f50276addb994ce3c461b125a (patch)
tree6d585bd66b9e8e6f7bdd8f4ec48e5ed06c3d3cef /libexec
parent3d864f957f553d41aa4a8fa2d0b392ba7e07e624 (diff)
Fill in load/end address for binary.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ld.so/loader.c14
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)