]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Modules: Be stricter recognizing init&exit sesections
authorRusty Russell <rusty@rustcorp.com.au>
Sun, 7 Sep 2003 13:46:23 +0000 (06:46 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Sun, 7 Sep 2003 13:46:23 +0000 (06:46 -0700)
Someone pointed out that -ffunction-sections can cause a function called
"init<something>" to be put in the init section, and discarded.  This
hurts PARISC badly.  Get more fussy with identifying them.

kernel/module.c

index 8a67a83ecc1fe1d8f6007d7bcfb7360685672373..3741dfa38610249befa102e76f0bb892153f33c7 100644 (file)
@@ -1211,7 +1211,8 @@ static void layout_sections(struct module *mod,
                        if ((s->sh_flags & masks[m][0]) != masks[m][0]
                            || (s->sh_flags & masks[m][1])
                            || s->sh_entsize != ~0UL
-                           || strstr(secstrings + s->sh_name, ".init"))
+                           || strncmp(secstrings + s->sh_name,
+                                      ".init", 5) == 0)
                                continue;
                        s->sh_entsize = get_offset(&mod->core_size, s);
                        DEBUGP("\t%s\n", secstrings + s->sh_name);
@@ -1228,7 +1229,8 @@ static void layout_sections(struct module *mod,
                        if ((s->sh_flags & masks[m][0]) != masks[m][0]
                            || (s->sh_flags & masks[m][1])
                            || s->sh_entsize != ~0UL
-                           || !strstr(secstrings + s->sh_name, ".init"))
+                           || strncmp(secstrings + s->sh_name,
+                                      ".init", 5) != 0)
                                continue;
                        s->sh_entsize = (get_offset(&mod->init_size, s)
                                         | INIT_OFFSET_MASK);
@@ -1434,7 +1436,7 @@ static struct module *load_module(void __user *umod,
                }
 #ifndef CONFIG_MODULE_UNLOAD
                /* Don't load .exit sections */
-               if (strstr(secstrings+sechdrs[i].sh_name, ".exit"))
+               if (strncmp(secstrings+sechdrs[i].sh_name, ".exit", 5) == 0)
                        sechdrs[i].sh_flags &= ~(unsigned long)SHF_ALLOC;
 #endif
        }