Subject: kvm_mkdb broken +FIX: patch to sys/arch/pmax/param.h
To: None <email@example.com>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
Date: 09/15/1994 17:43:12
The NetBSD create_knlist() in kvm_mkdb defaults to using
KERNBASE to relocate the version string, if KERNTEXTOFF isn't
defined. This has no effect on pmax kernels built by compilers
that don't prepend underscores to labels.
If one builds a kernel with a compiler that DOES prepend underscores
(by making the obvious tweaks, e.g. adding
#define ASM_OUTPUT_LABELREF(STREAM,NAME) fprintf (STREAM, "%_s", NAME)
in a GCC tm.h, adding lots of underscores to locore.s and crt0.s,
and rebuilding the world),
/usr/sbin/kvm_mkdb will find the symbol "_version" defined, attempt
to relocate it in the aout file using KERNBASE isntead of KERNTEXTOFF,
and promptly say "corrupted string table".
The fix (other than using a better object format) is to properly
define KERNTEXTOFF in param.h. The patch below fixes this.
More generally, I don't see that defaulting KERNTEXTOFF to KERNBASE is
really appropriate. If they end up being the same for a particular
machine, then that machine can define them so. The current defaulting
in usr.sbin/kvm_mkdb/nlist.c just makes porting harder. I'd argue for
getting rid of it. Where's an appropriate place to suggest that?
*** 1.1 1994/05/30 11:07:56
--- param.h 1994/09/15 22:49:38
*** 67,72 ****
--- 67,73 ----
#define SEGSHIFT 22 /* LOG2(NBSEG) */
#define KERNBASE 0x80000000 /* start of kernel virtual */
+ #define KERNTEXTOFF 0x80030000 /* start of kernel text for kvm_mkdb */
#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
#define DEV_BSIZE 512