Click to See Complete Forum and Search --> : LKM: unresolved symbols


threadhead
11-23-2003, 06:28 PM
hi!

ive been programming a small lkm and encountering
the following problem when insmodding it.
(i am running a 2.4.20 kernel)


mod.o: unsresolved symbol __start___ksymtab
mod.o: unsresolved symbol __stop___ex_table
mod.o: unsresolved symbol __start___ex_table


the code i am trying to insert looks like that:

#define __KERNEL__
#define MODULE

#include <linux/kernel.h>
#include <linux/module.h>
#include <asm/uaccess.h>

MODULE_LICENSE("GPL");
MODULE_AUTHOR("me");

extern struct module_symbol __start___ksymtab[];
extern struct module_symbol __stop___ksymtab[];

extern const struct exception_table_entry __start___ex_table[];
extern const struct exception_table_entry __stop___ex_table[];

extern const char __start___kallsyms[] __attribute__ ((weak));
extern const char __stop___kallsyms[] __attribute__ ((weak));


...
...
...



why are these symbols unresolved?
i found these declarations in kernel/module.c in the linux source tree.. so it should be working.
how can i let these symbols resolve and make my lkm work?

thanx ;)

bwkaz
11-24-2003, 07:58 PM
Is MODVERSIONS defined in your kernel sources?

If so, then the symbols don't actually look like that. They have more characters in them due to module versioning.

If MODVERSIONS is defined (or you could check linux/autoconf.h for CONFIG_MODVERSIONS), then you need to include <linux/modversions.h> either before or after <linux/module.h>. I think after, but maybe before. Check a real kernel module to be sure.

threadhead
11-25-2003, 01:44 PM
well my linux/autoconf.h
looks like that


/*
* Loadable module support
*/

#define CONFIG_MODULE 1
#undef CONFIG_MODVERSIONS
#define CONFIG_KMOD 1

...
...


i added some code to make the lkm work, although with no success.


...
...
#if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
#include <linux/modversions.h>
#define MODVERSIONS
#endif

...
/* not quite sure bout that include */
#include <linux/modsetver.h>
...
...

/* struct declarations as before */
...

EXPORT_SYMBOL_NOVERS(__start___ex_table);
...


when using the macro EXPORT_SYMBOL_NOVERS it says, when compiling:

mod.c:29: parse error before "this_object_must_be_defined_as_export_objs_in_the_ Makefile"
mod.c:29: warning: data definition has no type or storage class


what am i doing wrong?

bwkaz
11-25-2003, 08:53 PM
Sorry, but I haven't the slightest clue...

If you can find the definition of EXPORT_SYMBOL_NOVERS, you might be able to figure out why it's erroring on that symbol. But I don't know.

threadhead
11-26-2003, 01:54 PM
k thanks for the help.