summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sys/os/os_elf64.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/sys/os/os_elf64.c b/src/sys/os/os_elf64.c
index 8f95f9c..ad13424 100644
--- a/src/sys/os/os_elf64.c
+++ b/src/sys/os/os_elf64.c
@@ -119,11 +119,6 @@ elf64_do_load(Elf64_Ehdr *eh, struct proc *proc)
prot = 0;
phdr = PHDR_I(phdr_base, i);
- /* Don't cover blank segments */
- if (phdr->p_memsz == 0) {
- continue;
- }
-
/* What segment type is this? */
switch (phdr->p_type) {
case PT_LOAD:
@@ -134,6 +129,10 @@ elf64_do_load(Elf64_Ehdr *eh, struct proc *proc)
if (ISSET(phdr->p_flags, PF_X))
prot |= PROT_EXEC;
+ if (phdr->p_memsz == 0 && phdr->p_filesz == 0) {
+ continue;
+ }
+
/* Re-align the length */
misalign = phdr->p_memsz & (PSIZE - 1);
len = phdr->p_memsz;