diff options
| author | martin <martin@NetBSD.org> | 2007-06-05 08:48:49 +0000 |
|---|---|---|
| committer | martin <martin@NetBSD.org> | 2007-06-05 08:48:49 +0000 |
| commit | 933b671bfacee96e4b9ca105f1aecca3e156bc59 (patch) | |
| tree | 12a1bcad8c2002ab7e33831f375d8988c83a26dd /sys/lib | |
| parent | bbb24892dde752216bbccdc9d063ff036c20a697 (diff) | |
Add a MARK_DATA marker containing the effective VA of the first loaded
data segment.
Diffstat (limited to 'sys/lib')
| -rw-r--r-- | sys/lib/libsa/loadfile.h | 11 | ||||
| -rw-r--r-- | sys/lib/libsa/loadfile_aout.c | 3 | ||||
| -rw-r--r-- | sys/lib/libsa/loadfile_ecoff.c | 3 | ||||
| -rw-r--r-- | sys/lib/libsa/loadfile_elf32.c | 5 |
4 files changed, 14 insertions, 8 deletions
diff --git a/sys/lib/libsa/loadfile.h b/sys/lib/libsa/loadfile.h index fb938308ed9..7787b04884d 100644 --- a/sys/lib/libsa/loadfile.h +++ b/sys/lib/libsa/loadfile.h @@ -1,4 +1,4 @@ -/* $NetBSD: loadfile.h,v 1.5 2003/04/29 13:03:55 scw Exp $ */ +/* $NetBSD: loadfile.h,v 1.6 2007/06/05 08:48:49 martin Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -41,10 +41,11 @@ */ #define MARK_START 0 #define MARK_ENTRY 1 -#define MARK_NSYM 2 -#define MARK_SYM 3 -#define MARK_END 4 -#define MARK_MAX 5 +#define MARK_DATA 2 +#define MARK_NSYM 3 +#define MARK_SYM 4 +#define MARK_END 5 +#define MARK_MAX 6 /* * Bit flags for sections to load diff --git a/sys/lib/libsa/loadfile_aout.c b/sys/lib/libsa/loadfile_aout.c index da50a6bf404..64b0e4247e6 100644 --- a/sys/lib/libsa/loadfile_aout.c +++ b/sys/lib/libsa/loadfile_aout.c @@ -1,4 +1,4 @@ -/* $NetBSD: loadfile_aout.c,v 1.8 2005/12/11 12:24:46 christos Exp $ */ +/* $NetBSD: loadfile_aout.c,v 1.9 2007/06/05 08:48:50 martin Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -179,6 +179,7 @@ loadfile_aout(fd, x, marks, flags) if (flags & LOAD_DATA) { PROGRESS(("+%ld", x->a_data)); + marks[MARK_DATA] = LOADADDR(maxp); if (READ(fd, maxp, x->a_data) != (ssize_t)x->a_data) { WARN(("read data")); return 1; diff --git a/sys/lib/libsa/loadfile_ecoff.c b/sys/lib/libsa/loadfile_ecoff.c index b224bdbdaca..c0802cae1d3 100644 --- a/sys/lib/libsa/loadfile_ecoff.c +++ b/sys/lib/libsa/loadfile_ecoff.c @@ -1,4 +1,4 @@ -/* $NetBSD: loadfile_ecoff.c,v 1.6 2005/12/11 12:24:46 christos Exp $ */ +/* $NetBSD: loadfile_ecoff.c,v 1.7 2007/06/05 08:48:50 martin Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -141,6 +141,7 @@ loadfile_coff(fd, coff, marks, flags) marks[MARK_NSYM] = 1; /* XXX: Kernel needs >= 0 */ marks[MARK_SYM] = LOADADDR(maxp); marks[MARK_END] = LOADADDR(maxp); + marks[MARK_DATA] = LOADADDR(coff->a.data); return 0; } diff --git a/sys/lib/libsa/loadfile_elf32.c b/sys/lib/libsa/loadfile_elf32.c index 87f17786ad2..6ced6b9ece0 100644 --- a/sys/lib/libsa/loadfile_elf32.c +++ b/sys/lib/libsa/loadfile_elf32.c @@ -1,4 +1,4 @@ -/* $NetBSD: loadfile_elf32.c,v 1.16 2006/04/06 09:25:58 cherry Exp $ */ +/* $NetBSD: loadfile_elf32.c,v 1.17 2007/06/05 08:48:50 martin Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -318,6 +318,9 @@ ELFNAMEEND(loadfile)(fd, elf, marks, flags) (IS_DATA(phdr[i]) && (flags & LOAD_DATA))) { loadseg: + if (marks[MARK_DATA] == 0 && IS_DATA(phdr[i])) + marks[MARK_DATA] = LOADADDR(phdr[i].p_vaddr); + /* Read in segment. */ PROGRESS(("%s%lu", first ? "" : "+", (u_long)phdr[i].p_filesz)); |
