Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/lib/libsa From Nigel Pearson: Make SYMS and NSYMS work o...
details: https://anonhg.NetBSD.org/src/rev/8fc6abf34b50
branches: trunk
changeset: 512673:8fc6abf34b50
user: christos <christos%NetBSD.org@localhost>
date: Fri Jul 13 17:17:12 2001 +0000
description:
>From Nigel Pearson: Make SYMS and NSYMS work on ELF.
The MacOS booter needs them.
diffstat:
sys/lib/libsa/loadfile.c | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diffs (49 lines):
diff -r 4134ab313c18 -r 8fc6abf34b50 sys/lib/libsa/loadfile.c
--- a/sys/lib/libsa/loadfile.c Fri Jul 13 17:00:35 2001 +0000
+++ b/sys/lib/libsa/loadfile.c Fri Jul 13 17:17:12 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile.c,v 1.10 2000/12/03 02:53:04 tsutsui Exp $ */
+/* $NetBSD: loadfile.c,v 1.11 2001/07/13 17:17:12 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -277,8 +277,8 @@
int i;
size_t sz;
int first;
- int havesyms;
- paddr_t minp = ~0, maxp = 0, pos;
+ int havesyms, numsyms;
+ paddr_t minp = ~0, maxp = 0, pos, symp;
paddr_t offset = marks[MARK_START], shpp, elfp;
for (first = 1, i = 0; i < elf->e_phnum; i++) {
@@ -383,6 +383,14 @@
havesyms = 1;
for (first = 1, i = 0; i < elf->e_shnum; i++) {
+ if (shp[i].sh_type == SHT_SYMTAB) {
+ if (symp == NULL) {
+ /* Save addr of first sym section */
+ symp = maxp;
+ }
+ numsyms += roundup(shp[i].sh_size,
+ sizeof(long));
+ }
if (shp[i].sh_type == SHT_SYMTAB ||
shp[i].sh_type == SHT_STRTAB) {
if (havesyms && (flags & LOAD_SYM)) {
@@ -431,8 +439,11 @@
marks[MARK_START] = LOADADDR(minp);
marks[MARK_ENTRY] = LOADADDR(elf->e_entry);
- marks[MARK_NSYM] = 1; /* XXX: Kernel needs >= 0 */
- marks[MARK_SYM] = LOADADDR(elfp);
+ if (!numsyms)
+ marks[MARK_NSYM] = 1; /* XXX: Kernel needs >= 0 */
+ else
+ marks[MARK_NSYM] = numsyms;
+ marks[MARK_SYM] = LOADADDR(symp);
marks[MARK_END] = LOADADDR(maxp);
return 0;
}
Home |
Main Index |
Thread Index |
Old Index