diff options
Diffstat (limited to 'sys/lib/libsa/loadfile_elf.c')
-rw-r--r-- | sys/lib/libsa/loadfile_elf.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/lib/libsa/loadfile_elf.c b/sys/lib/libsa/loadfile_elf.c index 083a286d5b0..432f977e712 100644 --- a/sys/lib/libsa/loadfile_elf.c +++ b/sys/lib/libsa/loadfile_elf.c @@ -1,5 +1,5 @@ /* $NetBSD: loadfile.c,v 1.10 2000/12/03 02:53:04 tsutsui Exp $ */ -/* $OpenBSD: loadfile_elf.c,v 1.10 2014/10/26 10:33:48 miod Exp $ */ +/* $OpenBSD: loadfile_elf.c,v 1.11 2015/05/19 20:39:12 miod Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -99,7 +99,7 @@ ELFNAME(exec)(int fd, Elf_Ehdr *elf, u_long *marks, int flags) int m; /* Fill segment if asked for. */ - if (flags & LOAD_DATA) { + if (flags & LOAD_RANDOM) { for (pos = 0; pos < phdr[i].p_filesz; pos += m) { m = MIN(phdr[i].p_filesz - pos, @@ -108,6 +108,11 @@ ELFNAME(exec)(int fd, Elf_Ehdr *elf, u_long *marks, int flags) m); } } + if (flags & (LOAD_RANDOM | COUNT_RANDOM)) { + marks[MARK_RANDOM] = LOADADDR(phdr[i].p_paddr); + marks[MARK_ERANDOM] = + marks[MARK_RANDOM] + phdr[i].p_filesz; + } continue; } |