Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Feb 2000 14:28:46 +0200
From:      Ruslan Ermilov <ru@ucb.crimea.ua>
To:        Garrett Wollman <wollman@khavrinen.lcs.mit.edu>, Bruce Evans <bde@zeta.org.au>, Peter Wemm <peter@netplex.com.au>
Cc:        committers@FreeBSD.org, current@FreeBSD.org, dcs@FreeBSD.org
Subject:   Re: pstat(8) depends on loader(8)???
Message-ID:  <20000218142846.A14682@relay.ucb.crimea.ua>
In-Reply-To: <200002070238.VAA24590@khavrinen.lcs.mit.edu>; from Garrett Wollman on Sun, Feb 06, 2000 at 09:38:41PM -0500
References:  <wollman@khavrinen.lcs.mit.edu> <20000207141429.64F221CDD@overcee.netplex.com.au> <20000207002551.A69709@relay.ucb.crimea.ua> <Pine.BSF.4.21.0002071509470.7650-100000@alphplex.bde.org> <20000207002551.A69709@relay.ucb.crimea.ua> <200002070238.VAA24590@khavrinen.lcs.mit.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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?

On Sun, Feb 06, 2000 at 09:38:41PM -0500, Garrett Wollman wrote:
> <<On Mon, 7 Feb 2000 00:25:51 +0200, Ruslan Ermilov <ru@ucb.crimea.ua> said:
> 
> > If I boot with loader(8), everything is ok.
> > Ideas?
> 
> loader loads the kernel symbol table; boot2 does not.
> 
> -GAWollman

On Mon, Feb 07, 2000 at 03:22:36PM +1100, Bruce Evans wrote:
> On Mon, 7 Feb 2000, Ruslan Ermilov wrote:
> 
> > If I boot the system without loader(8), e.g. with /boot.config=kernel,
> > or by interrupting boot blocks and typing /kernel, swapinfo(8) fails:
> > 
> > swapinfo: undefined symbol: _numvnodes
> 
> This is because the elf format puts static symbols in an out-of-the-way
> section, and the boot2 stage of the bootstrap loads sections naively.
> Static symbols end up in a place where the kernel linker can't find
> them.  `numvnodes' is a static symbol...  Global symbols are found
> correctly.
> 
> This bug has affected ddb for more than a year.  I don't believe in
> or use loader(8), and have "fixed" the problem in ddb by not using
> the kernel linker for ddb symbol lookup.  This also fixes the
> nonexistence of ddb symbols on booting with -d.
> 
> Bruce

On Mon, Feb 07, 2000 at 10:14:29PM +0800, Peter Wemm wrote:
> Garrett Wollman wrote:
> > <<On Mon, 7 Feb 2000 00:25:51 +0200, Ruslan Ermilov <ru@ucb.crimea.ua> said:
> > 
> > > If I boot with loader(8), everything is ok.
> > > Ideas?
> > 
> > loader loads the kernel symbol table; boot2 does not.
> > 
> > -GAWollman
> 
> 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.
> 
> Cheers,
> -Peter


-- 
Ruslan Ermilov		Sysadmin and DBA of the
ru@ucb.crimea.ua	United Commercial Bank,
ru@FreeBSD.org		FreeBSD committer,
+380.652.247.647	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age


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?20000218142846.A14682>