]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
module: fix module loading failure of large kernel modules for parisc
authorHelge Deller <deller@gmx.de>
Wed, 31 Dec 2008 11:31:18 +0000 (12:31 +0100)
committerRusty Russell <rusty@rustcorp.com.au>
Sun, 4 Jan 2009 22:10:13 +0000 (08:40 +1030)
When creating the final layout of a kernel module in memory, allow the
module loader to reserve some additional memory in front of a given section.
This is currently only needed for the parisc port which needs to put the
stub entries there to fulfill the 17/22bit PCREL relocations with large
kernel modules like xfs.

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (renamed fn)
include/linux/moduleloader.h
kernel/module.c

index eb1033957486670348f892b4d93117958af76c0a..c1f40c2f7ffbdffae2ff037d17df5a8a6b857957 100644 (file)
@@ -13,6 +13,9 @@ int module_frob_arch_sections(Elf_Ehdr *hdr,
                              char *secstrings,
                              struct module *mod);
 
+/* Additional bytes needed by arch in front of individual sections */
+unsigned int arch_mod_section_prepend(struct module *mod, unsigned int section);
+
 /* Allocator used for allocating struct module, core sections and init
    sections.  Returns NULL on failure. */
 void *module_alloc(unsigned long size);
index d3d254571bdab7ff8c7f1b2737c2cbcfc2fb9a62..4299aefc20b8b2d70ee37fc22a96b1bf810ac196 100644 (file)
@@ -1578,11 +1578,21 @@ static int simplify_symbols(Elf_Shdr *sechdrs,
        return ret;
 }
 
+/* Additional bytes needed by arch in front of individual sections */
+unsigned int __weak arch_mod_section_prepend(struct module *mod,
+                                            unsigned int section)
+{
+       /* default implementation just returns zero */
+       return 0;
+}
+
 /* Update size with this section: return offset. */
-static long get_offset(unsigned int *size, Elf_Shdr *sechdr)
+static long get_offset(struct module *mod, unsigned int *size,
+                      Elf_Shdr *sechdr, unsigned int section)
 {
        long ret;
 
+       *size += arch_mod_section_prepend(mod, section);
        ret = ALIGN(*size, sechdr->sh_addralign ?: 1);
        *size = ret + sechdr->sh_size;
        return ret;
@@ -1622,7 +1632,7 @@ static void layout_sections(struct module *mod,
                            || strncmp(secstrings + s->sh_name,
                                       ".init", 5) == 0)
                                continue;
-                       s->sh_entsize = get_offset(&mod->core_size, s);
+                       s->sh_entsize = get_offset(mod, &mod->core_size, s, i);
                        DEBUGP("\t%s\n", secstrings + s->sh_name);
                }
                if (m == 0)
@@ -1640,7 +1650,7 @@ static void layout_sections(struct module *mod,
                            || strncmp(secstrings + s->sh_name,
                                       ".init", 5) != 0)
                                continue;
-                       s->sh_entsize = (get_offset(&mod->init_size, s)
+                       s->sh_entsize = (get_offset(mod, &mod->init_size, s, i)
                                         | INIT_OFFSET_MASK);
                        DEBUGP("\t%s\n", secstrings + s->sh_name);
                }