Commit b7df5197 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] implement module_arch_cleanup() in all architectures

From: Rusty Russell <rusty@rustcorp.com.au>, David Mosberger

The patch below updates the other platforms with module_arch_cleanup().
Also, I added more debug output to kernel/module.c since I found it useful
to be able to see the final section layout.
parent f2248e8d
......@@ -300,3 +300,8 @@ module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
{
return 0;
}
void
module_arch_cleanup(struct module *mod)
{
}
......@@ -159,3 +159,8 @@ module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
{
return 0;
}
void
module_arch_cleanup(struct module *mod)
{
}
......@@ -123,3 +123,7 @@ int module_finalize(const Elf_Ehdr *hdr,
}
return 0;
}
void module_arch_cleanup(struct module *mod)
{
}
......@@ -568,3 +568,7 @@ int module_finalize(const Elf_Ehdr *hdr,
#endif
return 0;
}
void module_arch_cleanup(struct module *mod)
{
}
......@@ -269,3 +269,7 @@ int module_finalize(const Elf_Ehdr *hdr,
{
return 0;
}
void module_arch_cleanup(struct module *mod)
{
}
......@@ -384,3 +384,7 @@ int module_finalize(const Elf_Ehdr *hdr,
me->num_exentries);
return 0;
}
void module_arch_cleanup(struct module *mod)
{
}
......@@ -386,3 +386,7 @@ int module_finalize(const Elf_Ehdr *hdr,
kfree(me->arch.syminfo);
return 0;
}
void module_arch_cleanup(struct module *mod)
{
}
......@@ -145,3 +145,7 @@ int module_finalize(const Elf_Ehdr *hdr,
{
return 0;
}
void module_arch_cleanup(struct module *mod)
{
}
......@@ -273,3 +273,7 @@ int module_finalize(const Elf_Ehdr *hdr,
{
return 0;
}
void module_arch_cleanup(struct module *mod)
{
}
......@@ -230,3 +230,8 @@ int apply_relocate_add (Elf32_Shdr *sechdrs, const char *strtab,
return 0;
}
void
module_arch_cleanup(struct module *mod)
{
}
......@@ -231,3 +231,7 @@ int module_finalize(const Elf_Ehdr *hdr,
{
return 0;
}
void module_arch_cleanup(struct module *mod)
{
}
......@@ -41,4 +41,7 @@ int module_finalize(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
struct module *mod);
/* Any cleanup needed when module leaves. */
void module_arch_cleanup(struct module *mod);
#endif
......@@ -910,6 +910,9 @@ static void free_module(struct module *mod)
list_del(&mod->list);
spin_unlock_irq(&modlist_lock);
/* Arch-specific cleanup. */
module_arch_cleanup(mod);
/* Module unload stuff */
module_unload_free(mod);
......@@ -1276,6 +1279,7 @@ static struct module *load_module(void __user *umod,
mod->module_init = ptr;
/* Transfer each section which specifies SHF_ALLOC */
DEBUGP("final section addresses:\n");
for (i = 0; i < hdr->e_shnum; i++) {
void *dest;
......@@ -1293,6 +1297,7 @@ static struct module *load_module(void __user *umod,
sechdrs[i].sh_size);
/* Update sh_addr to point to copy in image. */
sechdrs[i].sh_addr = (unsigned long)dest;
DEBUGP("\t0x%lx %s\n", sechdrs[i].sh_addr, secstrings + sechdrs[i].sh_name);
}
/* Module has been moved. */
mod = (void *)sechdrs[modindex].sh_addr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment