From:  Rusty Russell <rusty@rustcorp.com.au>

Fix a problem with kallsyms being unable to look up symbols which are in
modules.

add_kallsyms should be above module_finalize, which means you can just use
the mod->symtab and mod->strtab members.


---

 25-akpm/kernel/module.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff -puN kernel/module.c~fix-kallsyms-in-modules kernel/module.c
--- 25/kernel/module.c~fix-kallsyms-in-modules	Fri Mar 12 13:57:18 2004
+++ 25-akpm/kernel/module.c	Fri Mar 12 13:57:18 2004
@@ -1243,7 +1243,15 @@ static void add_kallsyms(struct module *
 		mod->symtab[i].st_info
 			= elf_type(&mod->symtab[i], sechdrs, secstrings, mod);
 }
-#endif
+#else
+static inline void add_kallsyms(struct module *mod,
+				Elf_Shdr *sechdrs,
+				unsigned int symindex,
+				unsigned int strindex,
+				const char *secstrings)
+{
+}
+#endif /* CONFIG_KALLSYMS */
 
 /* Allocate and load the module: note that size of section 0 is always
    zero, and we rely on this for optional sections. */
@@ -1516,14 +1524,12 @@ static struct module *load_module(void _
 	percpu_modcopy(mod->percpu, (void *)sechdrs[pcpuindex].sh_addr,
 		       sechdrs[pcpuindex].sh_size);
 
+	add_kallsyms(mod, sechdrs, symindex, strindex, secstrings);
+
 	err = module_finalize(hdr, sechdrs, mod);
 	if (err < 0)
 		goto cleanup;
 
-#ifdef CONFIG_KALLSYMS
-	add_kallsyms(mod, sechdrs, symindex, strindex, secstrings);
-#endif
-
 	mod->args = args;
 	if (obsparmindex) {
 		err = obsolete_params(mod->name, mod->args,

_