Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / include / linux / moduleloader.h
blobeb1033957486670348f892b4d93117958af76c0a
1 #ifndef _LINUX_MODULELOADER_H
2 #define _LINUX_MODULELOADER_H
3 /* The stuff needed for archs to support modules. */
5 #include <linux/module.h>
6 #include <linux/elf.h>
8 /* These must be implemented by the specific architecture */
10 /* Adjust arch-specific sections. Return 0 on success. */
11 int module_frob_arch_sections(Elf_Ehdr *hdr,
12 Elf_Shdr *sechdrs,
13 char *secstrings,
14 struct module *mod);
16 /* Allocator used for allocating struct module, core sections and init
17 sections. Returns NULL on failure. */
18 void *module_alloc(unsigned long size);
20 /* Free memory returned from module_alloc. */
21 void module_free(struct module *mod, void *module_region);
23 /* Apply the given relocation to the (simplified) ELF. Return -error
24 or 0. */
25 int apply_relocate(Elf_Shdr *sechdrs,
26 const char *strtab,
27 unsigned int symindex,
28 unsigned int relsec,
29 struct module *mod);
31 /* Apply the given add relocation to the (simplified) ELF. Return
32 -error or 0 */
33 int apply_relocate_add(Elf_Shdr *sechdrs,
34 const char *strtab,
35 unsigned int symindex,
36 unsigned int relsec,
37 struct module *mod);
39 /* Any final processing of module before access. Return -error or 0. */
40 int module_finalize(const Elf_Ehdr *hdr,
41 const Elf_Shdr *sechdrs,
42 struct module *mod);
44 /* Any cleanup needed when module leaves. */
45 void module_arch_cleanup(struct module *mod);
47 #endif