kernel static symbols missing in DDB - some info for hackers

kernel static symbols missing in DDB - some info for hackers

Post by Leon Da » Thu, 19 Jul 2001 09:06:32

I know this topic has come up so many times. I too had issues finding
out why static symbols appear when you use the loader instead of boot2
directly. I scanned through the posts to see the true details as to
why this was happening. Everyone seems to point that there are some
smarts in the loader that allows ddb to see static symbols. (Bruce
knows a way of not using the loader, but it's beyond the point of this

This info is based on my knowledge of the 4.x tree.

I want to make things clear for new hackers. From what I can tell, the
loader does exactly what boot2 does in loading the kernel image. The
only major difference is appending module metadata at the end of the
kernel space (see sys/boot/i386/libi386/bootinfo.c:bi_copymodules()).
The metadata is basically:

1. the kernel name without directory prefix, eg "kernel"
2. the string "elf kernel" as the type
3. any arguments passed to the kernel, eg "-d" (not required)
4. the first address of the kernel space (load_addr)
5. the size of the kernel space (load_addr -> esym)
6. the elfheader
7. esym (sizeof(int))
8. ssym (sizeof(int))

the bootinfo.bi_modulep points to the start of this metadata
information and is then stored in the kernel as preload_metadata.

These variables are picked up by the kernel linker and used in
kern/link_elf.c and kern/subr_module.c. So really there isn't that
much smart inside the loader.

Hopes this information does good to those who need it.



1. Kernel modules missing symbols

For some reason when I try to install a kernel (w/make install) or
install the modules for that matter, I get told
depmod: unresolved symbols in /lib/modules/whatever/whatever/sis.o
sis.o being the driver for the on-board SiS 900 ethernet board. I've
gotten it to work before, so I don't know what's wrong now.
        This is the output from depmod sis.o:
# module             id=string
# pci module         vendor     device     subvendor  subdevice  class
class_mask driver_data
# isapnp module      cardvendor carddevice driver_data vendor
function   ...
# usb module         match_flags idVendor idProduct bcdDevice_lo
bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol
bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info
# module             pattern
# ieee1394 module    match_flags vendor_id model_id specifier_id
# module             id

        I'm sure there's a pile of more stuff I also have to tell you,
but I can't guess what it would be.
        Angus March
          VE2 UFP
Concordia University Amateur Radio (very frivolous)

2. Linux on a Raptor?

3. problems building kernel - missing symbols


5. Missing symbols in modules after kernel recompile

6. slackware: bare won't fit in floppy

7. Kernel modules missing symbols

8. portable way of doing "echo abc 2>&1 | tee -a /dev/fd/2 | wc"

9. Kernel Symbols missing in AIX4.3.2 (sema, shmem and msgque) ...

10. Kernel modules missing symbols

11. looking for info on /dev/kstat and kernel symbols un Solaris 2.x

12. kernel symbols for netstat -i info