summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-07-09 01:45:48 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-07-09 01:45:48 +0000
commit4dd1e0fe07fc8679acdc5ac4c42630d3361a3742 (patch)
treed3bba905d0207d046afc3d9ec18eca06eb075c8c
parentfe75c337e5ca75e45c03318bfcbafdab414a02a3 (diff)
changing kernel load address does not work that well w/ elf, load it where it was linked
-rw-r--r--sys/lib/libsa/exec_elf.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/lib/libsa/exec_elf.c b/sys/lib/libsa/exec_elf.c
index 0af5c810274..5b4bf9291ee 100644
--- a/sys/lib/libsa/exec_elf.c
+++ b/sys/lib/libsa/exec_elf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_elf.c,v 1.5 2000/05/30 21:59:30 mickey Exp $ */
+/* $OpenBSD: exec_elf.c,v 1.6 2002/07/09 01:45:47 mickey Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -97,20 +97,20 @@ elf_load(fd, xp)
#endif
if (ph->p_filesz && ph->p_flags & PF_X) {
pa = ph->p_vaddr;
- xp->text.addr = 0;
+ xp->text.addr = ph->p_vaddr;
xp->text.size = ph->p_filesz;
xp->text.foff = ph->p_offset;
} else if (ph->p_filesz && ph->p_flags & PF_W) {
- xp->data.addr = ph->p_vaddr - pa;
+ xp->data.addr = ph->p_vaddr;
xp->data.size = ph->p_filesz;
xp->data.foff = ph->p_offset;
if (ph->p_filesz < ph->p_memsz) {
- xp->bss.addr = ph->p_vaddr + ph->p_filesz - pa;
+ xp->bss.addr = ph->p_vaddr + ph->p_filesz;
xp->bss.size = ph->p_memsz - ph->p_filesz;
xp->bss.foff = 0;
}
} else if (!ph->p_filesz) {
- xp->bss.addr = ph->p_vaddr - pa;
+ xp->bss.addr = ph->p_vaddr;
xp->bss.size = ph->p_memsz;
xp->bss.foff = 0;
}