Subject: Loading LKMs at boot yields unresolved symbols, but from commandline
To: None <>
From: Jeff Rizzo <>
List: netbsd-users
Date: 03/04/2005 09:32:02
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

I've been working on some LKMs for a while (zaptel drivers for NetBSD),
and an issue that's been bugging me for a while is finally annoying
enough for me to try and figure out what's causing it.

The problem:  if I load the LKMs from the commandline, it's fine. 
However, when I configure things in lkm.conf for boot-time load, I get
undefined reference errors.  This is *with* the -s flag.

Loading from commandline:

slim:riz  ~/code/zaptel> sudo modload -s /usr/lkm/mod_zaptel.o 
Module loaded as ID 0
slim:riz  ~/code/zaptel> sudo modload -s /usr/lkm/mod_ztdummy.o
Module loaded as ID 1

At boot time:

Module loaded as ID 0
mod_ztdummy.o: /usr/lkm/mod_ztdummy.o(.text+0x12f): In function
/home/riz/code/zaptel/ztdummy/ztdummy.c:101: undefined reference to
/usr/lkm/mod_ztdummy.o(.text+0x250): In function `cleanup_module':
/home/riz/code/zaptel/ztdummy/ztdummy.c:152: undefined reference to
/usr/lkm/mod_ztdummy.o(.text+0x3f6): In function `ztdummy_timer':
/home/riz/code/zaptel/ztdummy/ztdummy.c:75: undefined reference to
undefined reference to `zt_transmit'
modload: can't prelink `/usr/lkm/mod_ztdummy.o' creating

... the first module loads, but the second (which requires symbols from
the first) doesn't.  Here's what /etc/lkm.conf looks like:

# path          options         entry           postinstall    
output          when
#/lkm/if_ipl.o  -               -               -              
-               -
/usr/lkm/mod_zaptel.o -s - - - AFTERMOUNT
/usr/lkm/mod_ztdummy.o -s - - - AFTERMOUNT

... as you can see, I _do_ have the -s flag in there.  Even more
interesting, someone else using this code (also on a 2.0 system, like
this one) is NOT seeing this problem.

What am I doing wrong, here?


Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

Version: GnuPG v1.2.6 (Darwin)