aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Cernekee <cernekee@gmail.com>2011-11-12 22:08:55 -0500
committerRusty Russell <rusty@rustcorp.com.au>2012-01-12 18:02:13 -0500
commit70b1e9161e903a9e1682aca3a832ed29ef876a4d (patch)
tree5b391043858bf70d5541b036504c80c5577be8fc
parent2485a4b610171f4e1c4ab0d053569747795c1bbe (diff)
module: Add comments describing how the "strmap" logic works
Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--kernel/module.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 178333c48d1e..cf9f1b6b3268 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2193,6 +2193,13 @@ static void layout_symtab(struct module *mod, struct load_info *info)
2193 2193
2194 src = (void *)info->hdr + symsect->sh_offset; 2194 src = (void *)info->hdr + symsect->sh_offset;
2195 nsrc = symsect->sh_size / sizeof(*src); 2195 nsrc = symsect->sh_size / sizeof(*src);
2196
2197 /*
2198 * info->strmap has a '1' bit for each byte of .strtab we want to
2199 * keep resident in mod->core_strtab. Everything else in .strtab
2200 * is unreferenced by the symbols in mod->core_symtab, and will be
2201 * discarded when add_kallsyms() compacts the string table.
2202 */
2196 for (ndst = i = 1; i < nsrc; ++i, ++src) 2203 for (ndst = i = 1; i < nsrc; ++i, ++src)
2197 if (is_core_symbol(src, info->sechdrs, info->hdr->e_shnum)) { 2204 if (is_core_symbol(src, info->sechdrs, info->hdr->e_shnum)) {
2198 unsigned int j = src->st_name; 2205 unsigned int j = src->st_name;
@@ -2215,6 +2222,8 @@ static void layout_symtab(struct module *mod, struct load_info *info)
2215 2222
2216 /* Append room for core symbols' strings at end of core part. */ 2223 /* Append room for core symbols' strings at end of core part. */
2217 info->stroffs = mod->core_size; 2224 info->stroffs = mod->core_size;
2225
2226 /* First strtab byte (and first symtab entry) are zeroes. */
2218 __set_bit(0, info->strmap); 2227 __set_bit(0, info->strmap);
2219 mod->core_size += bitmap_weight(info->strmap, strsect->sh_size); 2228 mod->core_size += bitmap_weight(info->strmap, strsect->sh_size);
2220} 2229}