Subject: Re: one LKM using symbols from another - cluebat, please
To: None <tech-kern@NetBSD.org>
From: Jeff Rizzo <riz@boogers.sf.ca.us>
List: tech-kern
Date: 10/19/2004 14:57:36
Jeff Rizzo wrote:

> I'm currently in the process of porting a set of drivers from FreeBSD 
> 5.2.1 which are "modules" in the FreeBSD sense, and I've made them 
> (well, the first two, so far) into LKMs on NetBSD.   One of the 
> drivers requires access to functions in the other, but when I load the 
> second module, I get 'undefined reference' errors for the functions in 
> the first module it calls.
>
> Obviously, I'm forgetting to do something here.  I don't work with 
> LKMs (or the kernel, for that matter) very much, so I'm feeling a bit 
> clueless...  Also, if it matters, this is on NetBSD 2.0_RC4, the i386 
> port.
>
> Thanks for any suggestions. +j
>
>
>
It has been suggested to me that I include some more specific 
information, so here goes.  The errors I wrote of come when I modload 
the LKM:

# modload mod_ztdummy.o
mod_ztdummy.o(.text+0x1cb): In function `ztdummy_initialize':
/home/riz/zaptel-bsd/trunk/ztdummy/ztdummy.c:100: undefined reference to 
`zt_register'
mod_ztdummy.o(.text+0x2cc): In function `cleanup_module':
/home/riz/zaptel-bsd/trunk/ztdummy/ztdummy.c:144: undefined reference to 
`zt_unregister'
mod_ztdummy.o(.text+0x472): In function `ztdummy_timer':
/home/riz/zaptel-bsd/trunk/ztdummy/ztdummy.c:75: undefined reference to 
`zt_receive'
mod_ztdummy.o(.text+0x47e):/home/riz/zaptel-bsd/trunk/ztdummy/ztdummy.c:76: 
undefined reference to `zt_transmit'
modload: can't prelink `mod_ztdummy.o' creating `mod_ztdummy'

... all the 'undefined references' are to functions in a module which is 
already loaded:
# modstat
Type    Id   Offset Loadaddr Size Info     Rev Module Name
DEV       0  -1/165 ce480000 00a0 ce48ac00   2 zaptel

Thanks,
+j