Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Feb 2000 00:50:45 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Ruslan Ermilov <ru@ucb.crimea.ua>
Cc:        Garrett Wollman <wollman@khavrinen.lcs.mit.edu>, Peter Wemm <peter@netplex.com.au>, committers@FreeBSD.org, current@FreeBSD.org, dcs@FreeBSD.org
Subject:   Re: pstat(8) depends on loader(8)???
Message-ID:  <Pine.BSF.4.21.0002210039130.62512-100000@alphplex.bde.org>
In-Reply-To: <20000218142846.A14682@relay.ucb.crimea.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 18 Feb 2000, Ruslan Ermilov wrote:

> Hi!
> 
> Why then it works on 3.4-STABLE (booting without loader(8) and
> having kvm(3) programs like pstat(8) and top(1) working).
> What makes a difference here?

RCS file: /home/ncvs/src/lib/libkvm/kvm_file.c,v
Working file: kvm_file.c
head: 1.10
...
----------------------------
revision 1.9
date: 1999/12/27 07:14:57;  author: peter;  state: Exp;  lines: +5 -0
Use kldsym(2) to lookup symbol values.  This avoids the kvm_mkdb juggling
and is module aware.  Yes, this means that kvm_nlist(3) will find symbols
in loaded modules.  The emulation of the nlist struct is pretty crude but
seems to work well enough for all the users in the tree that I found.
----------------------------

> On Mon, Feb 07, 2000 at 10:14:29PM +0800, Peter Wemm wrote:

> > More to the point, a non-stripped kernel has *two* symbol tables.  One that
> > has the global symbols and is used for dynamic linking, and the other that
> > has the debugging info in it including static symbols.  loader(8) goes to a
> > great deal of trouble to get the second table - it's very hard to get it
> > when reading from a zlib decompression stream that can't be seek'ed.  The ELF
> > format defines a convenient 'load segment' table which defines (usually)
> > two chunks of the file to be loaded into memory and at what addresses.  The
> > verbose symbol table is not part of this, but the global table is and we get
> > it for free.
> > 
> > Anyway, the correct fix is to make numvnodes global or to change it to a
> > sysctl.  Nothing that is referred to by the common libkvm applications
> > should be static - this warning has been given before.  running a strip on /
> > kernel has the same effect as using boot2 - only global symbols are
> > accessible.

The former would be a very incorrect fix.  C linkage shouldn't be weakened
to work around deficiencies in binary utilities.

Bruce



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0002210039130.62512-100000>