/* * This patch makes insmod/modprobe add all symbols, including * local/static symbols to the kernel symbol table. It helps * debugging greatly. This patch is not meant for general * consumption. * * --Steven Bytnar, sbytnar at users sourceforge net */ diff -ur modutils-2.3.24.orig/insmod/insmod.c modutils-2.3.24/insmod/insmod.c --- modutils-2.3.24.orig/insmod/insmod.c Sat Dec 16 07:59:49 2000 +++ modutils-2.3.24/insmod/insmod.c Wed Jan 17 18:59:44 2001 @@ -70,6 +70,7 @@ #include #include #include +#include #include "module.h" #include "obj.h" @@ -503,7 +504,7 @@ static int create_module_ksymtab(struct obj_file *f) { - struct obj_section *sec; + struct obj_section *sec = NULL; int i; /* We must always add the module references. */ @@ -547,6 +548,29 @@ && (sym->secidx >= SHN_LORESERVE || loaded[sym->secidx])) { add_ksymtab(f, sym); + } else if (ELFW(ST_BIND)(sym->info) == STB_LOCAL + && sym->secidx <= SHN_HIRESERVE + && (sym->secidx >= SHN_LORESERVE + || loaded[sym->secidx]) + && sym->value != 0) { + int l; + char *name; + const char *prefix; + struct obj_symbol *lsym; + sec = obj_find_section(f, ".this"); + prefix = strrchr(f->filename, '/'); + if (prefix == NULL) + prefix = f->filename; + l = strlen(prefix)+ /* module name */ + 1+ /* "_" */ + strlen(sym->name)+ /* the local symbol */ + 1; /* nul */ + name = xmalloc(l); + snprintf(name, l, "%s_%s", prefix, sym->name); + assert(sec != NULL); + lsym = obj_add_symbol(f, name, -1, ELFW(ST_INFO) (STB_GLOBAL, STT_NOTYPE), + sym->secidx, sym->value, 0); + add_ksymtab(f, lsym); } } }