diff --git a/defs.h b/defs.h index 0fe9d48..18546eb 100755 --- a/defs.h +++ b/defs.h @@ -2014,6 +2014,7 @@ struct symbol_table_data { #define MOD_KALLSYMS (0x8) #define MOD_INITRD (0x10) #define MOD_NOPATCH (0x20) +#define MOD_INIT (0x40) #define SEC_FOUND (0x10000) diff --git a/symbols.c b/symbols.c index ad3c32d..ac4ba98 100755 --- a/symbols.c +++ b/symbols.c @@ -1950,6 +1950,8 @@ store_module_kallsyms_v2(struct load_module *lm, int start, int curr, } lm->mod_flags |= MOD_KALLSYMS; + if (lm->mod_init_size > 0) + lm->mod_flags |= MOD_INIT; FREEBUF(module_buf); if (module_buf_init) FREEBUF(module_buf_init); @@ -3641,26 +3643,20 @@ module_symbol(ulong value, } static struct syment * -value_search_module(ulong value, ulong *offset, int search_init_section) +value_search_module(ulong value, ulong *offset) { int i; + int retry; struct syment *sp, *sp_end, *spnext, *splast; struct load_module *lm; for (i = 0; i < st->mods_installed; i++) { + retry = 1; lm = &st->load_modules[i]; - if (!search_init_section) { - sp = lm->mod_symtable; - sp_end = lm->mod_symend; - } else { - if (lm->mod_init_symtable) { - sp = lm->mod_init_symtable; - sp_end = lm->mod_init_symend; - } else - continue; - } - + sp = lm->mod_symtable; + sp_end = lm->mod_symend; +retry: if (sp->value > value) /* invalid -- between modules */ break; @@ -3710,6 +3706,13 @@ value_search_module(ulong value, ulong *offset, int search_init_section) splast = sp; } } + + if (retry && (lm->mod_flags & MOD_INIT)) { + retry = 0; + sp = lm->mod_init_symtable; + sp_end = lm->mod_init_symend; + goto retry; + } } return((struct syment *)NULL); @@ -3731,7 +3734,7 @@ value_search(ulong value, ulong *offset) return sp; if (IS_VMALLOC_ADDR(value)) - goto check_modules; + return value_search_module(value, offset); if ((sp = symval_hash_search(value)) == NULL) sp = st->symtable; @@ -3756,11 +3759,6 @@ value_search(ulong value, ulong *offset) } } -check_modules: - sp = value_search_module(value, offset, 0); - if (!sp) - sp = value_search_module(value, offset, 1); - return sp; }