Re: undefined reference

Keith Owens (kaos@ocs.com.au)
Tue, 26 Mar 2002 16:49:58 +1100


On Tue, 26 Mar 2002 12:17:50 +0800,
"Anthony Chee" <anthony.chee@polyu.edu.hk> wrote:
>Or let me say clearly.
>
>The suitution is I want the kernel source use the symbol from module.
>
>What I did in the module code are:
>1. EXPORT_SYMBOL(func) in the source code of module
>2. Set "extern int func()" in the module header
>
>What I did in the kernel source code are:
>1. Insert "func()" in the inode.c
>2. Add the module header in the kernel source code
>
>Then I use "make bzImage", I got no error message on compiling inode.c, but
>I got
>
>"fs/fs.o(.text+0x1377d): undefined reference to `func'"

You cannot do that. The kernel must be self contained. The only way
for the kernel to access module code and data is for the module to
register that code and data when the module is loaded and for the
kernel to access the module via the registration list.

See any module that handles a filesystem. sys_open() does not call the
module directly. A module registers its file operations on load. The
kernel (dentry_open) calls the module via f->f_op->open.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/