summaryrefslogtreecommitdiff
path: root/sys/lib/libsa/exec_elf.c
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1998-08-27 20:38:16 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1998-08-27 20:38:16 +0000
commit8920f7d81de2e4e2e87f2287b2911603dc84d9ec (patch)
tree1beb309d9caf1b7598284655741e67e02b9d543c /sys/lib/libsa/exec_elf.c
parent7be4dda1718c16957980b9edb730ad77f601d043 (diff)
better .bss treatment
Diffstat (limited to 'sys/lib/libsa/exec_elf.c')
-rw-r--r--sys/lib/libsa/exec_elf.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/lib/libsa/exec_elf.c b/sys/lib/libsa/exec_elf.c
index 79844fb90cb..04dc58ad3dd 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.3 1998/07/29 00:37:52 mickey Exp $ */
+/* $OpenBSD: exec_elf.c,v 1.4 1998/08/27 20:38:15 mickey Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -96,16 +96,21 @@ elf_load(fd, xp)
ph->p_offset, ph->p_vaddr, ph->p_filesz,
ph->p_memsz, ph->p_flags);
#endif
- if (ntohl(ph->p_filesz) && ntohl(ph->p_flags) & PF_X) {
+ if (ph->p_filesz && ph->p_flags & PF_X) {
pa = ph->p_vaddr;
xp->text.addr = 0;
xp->text.size = ph->p_filesz;
xp->text.foff = ph->p_offset;
- } else if (ntohl(ph->p_filesz) && ntohl(ph->p_flags) & PF_W) {
+ } else if (ph->p_filesz && ph->p_flags & PF_W) {
xp->data.addr = ph->p_vaddr - pa;
xp->data.size = ph->p_filesz;
xp->data.foff = ph->p_offset;
- } else if (!ntohl(ph->p_filesz)) {
+ if (ph->p_filesz < ph->p_memsz) {
+ xp->bss.addr = ph->p_vaddr + ph->p_filesz - pa;
+ 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.size = ph->p_memsz;
xp->bss.foff = 0;