From owner-freebsd-current Fri Feb 18 4:30:50 2000 Delivered-To: freebsd-current@freebsd.org Received: from relay.ucb.crimea.ua (UCB-Async4-CRISCO.CRIS.NET [212.110.129.130]) by hub.freebsd.org (Postfix) with ESMTP id AE45C37B7DB; Fri, 18 Feb 2000 04:30:33 -0800 (PST) (envelope-from ru@ucb.crimea.ua) Received: (from ru@localhost) by relay.ucb.crimea.ua (8.9.3/8.9.3/UCB) id OAA26421; Fri, 18 Feb 2000 14:28:46 +0200 (EET) (envelope-from ru) Date: Fri, 18 Feb 2000 14:28:46 +0200 From: Ruslan Ermilov To: Garrett Wollman , Bruce Evans , Peter Wemm 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> Mail-Followup-To: Garrett Wollman , Bruce Evans , Peter Wemm , committers@FreeBSD.org, current@FreeBSD.org, dcs@FreeBSD.org References: <20000207141429.64F221CDD@overcee.netplex.com.au> <20000207002551.A69709@relay.ucb.crimea.ua> <20000207002551.A69709@relay.ucb.crimea.ua> <200002070238.VAA24590@khavrinen.lcs.mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i In-Reply-To: <200002070238.VAA24590@khavrinen.lcs.mit.edu>; from Garrett Wollman on Sun, Feb 06, 2000 at 09:38:41PM -0500 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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: > < 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: > > < 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