Re: pstat(8) depends on loader(8)???

2000-02-18 Thread Ruslan Ermilov

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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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
[EMAIL PROTECTED]United Commercial Bank,
[EMAIL PROTECTED]  FreeBSD committer,
+380.652.247.647Simferopol, Ukraine

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


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: pstat(8) depends on loader(8)???

2000-02-07 Thread Peter Wemm

Garrett Wollman wrote:
 On Mon, 7 Feb 2000 00:25:51 +0200, Ruslan Ermilov [EMAIL PROTECTED] 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




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: pstat(8) depends on loader(8)???

2000-02-07 Thread Peter Wemm

John Baldwin wrote:
 
 On 07-Feb-00 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.
 
 So all that needs to be fixed is for boot2.c to be more intelligent with ELF
 images then?

No, boot2 doesn't have room for this.

Cheers,
-Peter



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



RE: pstat(8) depends on loader(8)???

2000-02-06 Thread John Baldwin


On 06-Feb-00 Ruslan Ermilov wrote:
 Hi!
 
 Fresh -current, GENERIC kernel.
 
 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
 
 top(8) fails as well with:
 
 top: nlist failed
 
 If I boot with loader(8), everything is ok.
 Ideas?

Hmm.  My guess would be that the kernel is somehow not initializing
properly.  The loader doesn't set anything but environment variables
for the kernel to read, so it's not a matter of the loader setting
variables inside the kernel or anything.  Are you sure the kernel you
booted via boot.config is in sync with your world?

Other than that you probably need a person who is familiar with the
kernel startup code more than a loader expert.

-- 

John Baldwin [EMAIL PROTECTED] -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.cslab.vt.edu/~jobaldwi/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: pstat(8) depends on loader(8)???

2000-02-06 Thread Bruce Evans

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



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: pstat(8) depends on loader(8)???

2000-02-06 Thread John Baldwin


On 07-Feb-00 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.

So all that needs to be fixed is for boot2.c to be more intelligent with ELF
images then?

 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

-- 

John Baldwin [EMAIL PROTECTED] -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.cslab.vt.edu/~jobaldwi/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: pstat(8) depends on loader(8)???

2000-02-06 Thread Bruce Evans

On Mon, 7 Feb 2000, John Baldwin wrote:

 On 07-Feb-00 Bruce Evans wrote:
  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.
 
 So all that needs to be fixed is for boot2.c to be more intelligent with ELF
 images then?

Or the kernel linker.

Bruce



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message