1#ifndef _LINUX_MODULELOADER_H
2#define _LINUX_MODULELOADER_H
3
4
5#include <linux/module.h>
6#include <linux/elf.h>
7
8
9
10
11
12
13
14
15
16int module_frob_arch_sections(Elf_Ehdr *hdr,
17 Elf_Shdr *sechdrs,
18 char *secstrings,
19 struct module *mod);
20
21
22unsigned int arch_mod_section_prepend(struct module *mod, unsigned int section);
23
24
25
26void *module_alloc(unsigned long size);
27
28
29void module_memfree(void *module_region);
30
31
32
33
34
35#ifdef CONFIG_MODULES_USE_ELF_REL
36int apply_relocate(Elf_Shdr *sechdrs,
37 const char *strtab,
38 unsigned int symindex,
39 unsigned int relsec,
40 struct module *mod);
41#else
42static inline int apply_relocate(Elf_Shdr *sechdrs,
43 const char *strtab,
44 unsigned int symindex,
45 unsigned int relsec,
46 struct module *me)
47{
48 printk(KERN_ERR "module %s: REL relocation unsupported\n",
49 module_name(me));
50 return -ENOEXEC;
51}
52#endif
53
54
55
56
57
58#ifdef CONFIG_MODULES_USE_ELF_RELA
59int apply_relocate_add(Elf_Shdr *sechdrs,
60 const char *strtab,
61 unsigned int symindex,
62 unsigned int relsec,
63 struct module *mod);
64#else
65static inline int apply_relocate_add(Elf_Shdr *sechdrs,
66 const char *strtab,
67 unsigned int symindex,
68 unsigned int relsec,
69 struct module *me)
70{
71 printk(KERN_ERR "module %s: REL relocation unsupported\n",
72 module_name(me));
73 return -ENOEXEC;
74}
75#endif
76
77
78int module_finalize(const Elf_Ehdr *hdr,
79 const Elf_Shdr *sechdrs,
80 struct module *mod);
81
82
83void module_arch_cleanup(struct module *mod);
84
85
86void module_arch_freeing_init(struct module *mod);
87#endif
88