module_arch_cleanup()
Subsystems (6)
PATCH 1/1 module_arch_cleanup()
IA64 needs to be able to hook into module unloading to get rid of the unwind tables for modules. (The actual implementation already is in arch/ia64/kernel/module.c, David just seems to be to shy to submit core changes :))
include/asm-ia64/module.h +3 -0
@@ -31,4 +31,7 @@#define ARCH_SHF_SMALL SHF_IA_64_SHORT +void module_arch_cleanup (struct module *mod); +#define __HAVE_ARCH_MODULE_CLEANUP 1 +#endif /* _ASM_IA64_MODULE_H */
kernel/module.c +8 -0
@@ -47,6 +47,11 @@#define ARCH_SHF_SMALL 0#endif +/* Some architectures (like ia64) need to hook into module unloading */ +#ifndef __HAVE_ARCH_MODULE_CLEANUP +#define module_arch_cleanup (mod) do { } while (0) +#endif +/* If this is set, the section belongs in the init part of the module */ #define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))
@@ -909,6 +914,9 @@spin_lock_irq (&modlist_lock);list_del (&mod->list);spin_unlock_irq (&modlist_lock); + +/* Arch-specific cleanup. */ +module_arch_cleanup (mod);/* Module unload stuff */ module_unload_free (mod);
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Christoph Hellwig
Christoph> IA64 needs to be able to hook into module unloading to get rid of Christoph> the unwind tables for modules. (The actual implementation already Christoph> is in arch/ia64/kernel/module.c, David just seems to be to shy to Christoph> submit core changes :))
Actually, I did submit it, even though it's Rusty's code. See:
Rusty wanted module_arch_cleanup() to be an unconditional thing. Perhaps Linus disagreed and dropped it because of that. I don't really care. Just make it work. ;-)
--david
In message <[email protected]> you write:
Quoted 4 lines
IA64 needs to be able to hook into module unloading to get rid of the unwind tables for modules. (The actual implementation already is in
arch/ia64/kernel/module.c, David just seems to be to shy to submit core changes :))
Or he was waiting for me. Sorry David. Linus, please apply.
Name: module_arch_cleanup hook
Author: David Mosberger
Status: Trivial
D: The patch below updates the other platforms with
D: module_arch_cleanup(). Also, I added more debug output to
D: kernel/module.c since I found it useful to be able to see the final
D: section layout.
arch/alpha/kernel/module.c +5 -0
@@ -300,3 +300,8 @@ module_finalize(const Elf_Ehdr *hdr, con {return 0 ; } + +void +module_arch_cleanup (struct module *mod) +{ +}
arch/arm/kernel/module.c +5 -0
@@ -159,3 +159,8 @@ module_finalize(const Elf32_Ehdr *hdr, c {return 0 ; } + +void +module_arch_cleanup (struct module *mod) +{ +}
arch/i386/kernel/module.c +4 -0
@@ -123,3 +123,7 @@ int module_finalize(const Elf_Ehdr *hdr, }return 0 ; } + +void module_arch_cleanup (struct module *mod) +{ +}
arch/parisc/kernel/module.c +4 -0
@@ -568,3 +568,7 @@ int module_finalize(const Elf_Ehdr *hdr,#endif return 0 ; } + +void module_arch_cleanup (struct module *mod) +{ +}
arch/ppc/kernel/module.c +4 -0
@@ -269,3 +269,7 @@ int module_finalize(const Elf_Ehdr *hdr, {return 0 ; } + +void module_arch_cleanup (struct module *mod) +{ +}
arch/ppc64/kernel/module.c +4 -0
@@ -386,3 +386,7 @@ int module_finalize(const Elf_Ehdr *hdr, me->extable.entry + me->extable.num_entries);return 0 ; } + +void module_arch_cleanup (struct module *mod) +{ +}
arch/s390/kernel/module.c +4 -0
@@ -386,3 +386,7 @@ int module_finalize(const Elf_Ehdr *hdr,kfree (me->arch.syminfo);return 0 ; } + +void module_arch_cleanup (struct module *mod) +{ +}
arch/sparc/kernel/module.c +4 -0
@@ -145,3 +145,7 @@ int module_finalize(const Elf_Ehdr *hdr, {return 0 ; } + +void module_arch_cleanup (struct module *mod) +{ +}
arch/sparc64/kernel/module.c +4 -0
@@ -273,3 +273,7 @@ int module_finalize(const Elf_Ehdr *hdr, {return 0 ; } + +void module_arch_cleanup (struct module *mod) +{ +}
arch/v850/kernel/module.c +5 -0
@@ -230,3 +230,8 @@ int apply_relocate_add (Elf32_Shdr *sechreturn 0 ; } + +void +module_arch_cleanup (struct module *mod) +{ +}
arch/x86_64/kernel/module.c +4 -0
@@ -231,3 +231,7 @@ int module_finalize(const Elf_Ehdr *hdr, {return 0 ; } + +void module_arch_cleanup (struct module *mod) +{ +}
include/linux/moduleloader.h +3 -0
@@ -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
kernel/module.c +5 -0
@@ -910,6 +910,9 @@ static void free_module(struct module *mlist_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 _ 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 _ 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;
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.