1 #ifndef _LINUX_MODULELOADER_H
2 #define _LINUX_MODULELOADER_H
3 /* The stuff needed for archs to support modules. */
5 #include <linux/module.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,
16 /* Additional bytes needed by arch in front of individual sections */
17 unsigned int arch_mod_section_prepend(struct module *mod, unsigned int section);
19 /* Allocator used for allocating struct module, core sections and init
20 sections. Returns NULL on failure. */
21 void *module_alloc(unsigned long size);
23 /* Free memory returned from module_alloc. */
24 void module_free(struct module *mod, void *module_region);
26 /* Apply the given relocation to the (simplified) ELF. Return -error
28 int apply_relocate(Elf_Shdr *sechdrs,
30 unsigned int symindex,
34 /* Apply the given add relocation to the (simplified) ELF. Return
36 int apply_relocate_add(Elf_Shdr *sechdrs,
38 unsigned int symindex,
42 /* Any final processing of module before access. Return -error or 0. */
43 int module_finalize(const Elf_Ehdr *hdr,
44 const Elf_Shdr *sechdrs,
47 /* Any cleanup needed when module leaves. */
48 void module_arch_cleanup(struct module *mod);