]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
module: Add comments describing how the "strmap" logic works
authorKevin Cernekee <cernekee@gmail.com>
Sun, 13 Nov 2011 03:08:55 +0000 (19:08 -0800)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 14 Nov 2011 23:10:07 +0000 (10:10 +1100)
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
kernel/module.c

index 178333c48d1e5a60bfac3f3bef928452dd09aca2..cf9f1b6b3268e0315b8c63f3c506e7e79c3c6662 100644 (file)
@@ -2193,6 +2193,13 @@ static void layout_symtab(struct module *mod, struct load_info *info)
 
        src = (void *)info->hdr + symsect->sh_offset;
        nsrc = symsect->sh_size / sizeof(*src);
+
+       /*
+        * info->strmap has a '1' bit for each byte of .strtab we want to
+        * keep resident in mod->core_strtab.  Everything else in .strtab
+        * is unreferenced by the symbols in mod->core_symtab, and will be
+        * discarded when add_kallsyms() compacts the string table.
+        */
        for (ndst = i = 1; i < nsrc; ++i, ++src)
                if (is_core_symbol(src, info->sechdrs, info->hdr->e_shnum)) {
                        unsigned int j = src->st_name;
@@ -2215,6 +2222,8 @@ static void layout_symtab(struct module *mod, struct load_info *info)
 
        /* Append room for core symbols' strings at end of core part. */
        info->stroffs = mod->core_size;
+
+       /* First strtab byte (and first symtab entry) are zeroes. */
        __set_bit(0, info->strmap);
        mod->core_size += bitmap_weight(info->strmap, strsect->sh_size);
 }