/* $NetBSD: loadfile.h,v 1.1 1999/04/28 09:08:50 christos Exp $ */
-/* $OpenBSD: loadfile.h,v 1.3 2008/06/26 05:42:20 ray Exp $ */
+/* $OpenBSD: loadfile.h,v 1.4 2015/05/19 20:39:12 miod Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
#define MARK_NSYM 2
#define MARK_SYM 3
#define MARK_END 4
-#define MARK_MAX 5
+#define MARK_RANDOM 5
+#define MARK_ERANDOM 6
+#define MARK_MAX 7
/*
* Bit flags for sections to load
#define LOAD_BSS 0x0008
#define LOAD_SYM 0x0010
#define LOAD_HDR 0x0020
-#define LOAD_ALL 0x003f
+#define LOAD_RANDOM 0x0040
+#define LOAD_ALL 0x007f
#define COUNT_TEXT 0x0100
#define COUNT_TEXTA 0x0200
#define COUNT_BSS 0x0800
#define COUNT_SYM 0x1000
#define COUNT_HDR 0x2000
-#define COUNT_ALL 0x3f00
+#define COUNT_RANDOM 0x4000
+#define COUNT_ALL 0x7f00
int loadfile(const char *, u_long *, int);
/* $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.
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,
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;
}