Subject: RE: One LKM calls functions exported by another LKM
To: 'Quentin Garnier' <cube@cubidou.net>
From: George Chen <georgechen2101@msn.com>
List: tech-kern
Date: 03/09/2006 18:29:37
Hi Quentin,

It's solved. I verified.

Thanks a lot.

George Chen

-----Original Message-----
From: Quentin Garnier [mailto:cube@cubidou.net] 
Sent: 2006 03 09 18:16
To: george.chen@semptian.com
Cc: tech-kern@NetBSD.org
Subject: Re: One LKM calls functions exported by another LKM

On Thu, Mar 09, 2006 at 05:55:59PM +0800, George Chen wrote:
> 
> Hi guys,
> 
> I'm writing LKM (Loadable Kernel Module) and find I have to let LKM-A call
> functions exported by LKM-B. But I don't know how to implement it.
> 
> The function is spucall(), declared as usual function in LKM-B. 
> LKM-B: int spucall(int cmd);
> 
> it is referred to in LKM-A as below.
> LKM-A: extern int spucall(int cmd);
> 
> No warnings or errors were reported when making.
> 
> I loaded LKM-A first. When I loaded LKM-B, it failed with following
message
> 
> apu.o(.text+0xef): In function `apu_handle':
> : undefined reference to `spucall'
> apu.o(.text+0xff): In function `apu_handle':
> : undefined reference to `spucall'
> modload: can't prelink `apu.o' creating `apu'
> 
> No helpful messages were found in the web. Your instructions are highly
> appreciated!

Reading the manual page of modload(8) might prove useful, especially
the following bit:

     -s      Load the symbol table.

I encourage you, of course, to read the rest.

-- 
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"When I find the controls, I'll go where I like, I'll know where I want
to be, but maybe for now I'll stay right here on a silent sea."
KT Tunstall, Silent Sea, Eye to the Telescope, 2004.