diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/module.h | 40 | ||||
-rw-r--r-- | include/linux/moduleloader.h | 36 |
2 files changed, 65 insertions, 11 deletions
diff --git a/include/asm-generic/module.h b/include/asm-generic/module.h index ed5b44de4c91..14dc41d185a7 100644 --- a/include/asm-generic/module.h +++ b/include/asm-generic/module.h | |||
@@ -5,18 +5,44 @@ | |||
5 | * Many architectures just need a simple module | 5 | * Many architectures just need a simple module |
6 | * loader without arch specific data. | 6 | * loader without arch specific data. |
7 | */ | 7 | */ |
8 | #ifndef CONFIG_HAVE_MOD_ARCH_SPECIFIC | ||
8 | struct mod_arch_specific | 9 | struct mod_arch_specific |
9 | { | 10 | { |
10 | }; | 11 | }; |
12 | #endif | ||
11 | 13 | ||
12 | #ifdef CONFIG_64BIT | 14 | #ifdef CONFIG_64BIT |
13 | #define Elf_Shdr Elf64_Shdr | 15 | #define Elf_Shdr Elf64_Shdr |
14 | #define Elf_Sym Elf64_Sym | 16 | #define Elf_Phdr Elf64_Phdr |
15 | #define Elf_Ehdr Elf64_Ehdr | 17 | #define Elf_Sym Elf64_Sym |
16 | #else | 18 | #define Elf_Dyn Elf64_Dyn |
17 | #define Elf_Shdr Elf32_Shdr | 19 | #define Elf_Ehdr Elf64_Ehdr |
18 | #define Elf_Sym Elf32_Sym | 20 | #define Elf_Addr Elf64_Addr |
19 | #define Elf_Ehdr Elf32_Ehdr | 21 | #ifdef CONFIG_MODULES_USE_ELF_REL |
22 | #define Elf_Rel Elf64_Rel | ||
23 | #endif | ||
24 | #ifdef CONFIG_MODULES_USE_ELF_RELA | ||
25 | #define Elf_Rela Elf64_Rela | ||
26 | #endif | ||
27 | #define ELF_R_TYPE(X) ELF64_R_TYPE(X) | ||
28 | #define ELF_R_SYM(X) ELF64_R_SYM(X) | ||
29 | |||
30 | #else /* CONFIG_64BIT */ | ||
31 | |||
32 | #define Elf_Shdr Elf32_Shdr | ||
33 | #define Elf_Phdr Elf32_Phdr | ||
34 | #define Elf_Sym Elf32_Sym | ||
35 | #define Elf_Dyn Elf32_Dyn | ||
36 | #define Elf_Ehdr Elf32_Ehdr | ||
37 | #define Elf_Addr Elf32_Addr | ||
38 | #ifdef CONFIG_MODULES_USE_ELF_REL | ||
39 | #define Elf_Rel Elf32_Rel | ||
40 | #endif | ||
41 | #ifdef CONFIG_MODULES_USE_ELF_RELA | ||
42 | #define Elf_Rela Elf32_Rela | ||
43 | #endif | ||
44 | #define ELF_R_TYPE(X) ELF32_R_TYPE(X) | ||
45 | #define ELF_R_SYM(X) ELF32_R_SYM(X) | ||
20 | #endif | 46 | #endif |
21 | 47 | ||
22 | #endif /* __ASM_GENERIC_MODULE_H */ | 48 | #endif /* __ASM_GENERIC_MODULE_H */ |
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h index b2be02ebf453..560ca53a75fa 100644 --- a/include/linux/moduleloader.h +++ b/include/linux/moduleloader.h | |||
@@ -28,21 +28,49 @@ void *module_alloc(unsigned long size); | |||
28 | /* Free memory returned from module_alloc. */ | 28 | /* Free memory returned from module_alloc. */ |
29 | void module_free(struct module *mod, void *module_region); | 29 | void module_free(struct module *mod, void *module_region); |
30 | 30 | ||
31 | /* Apply the given relocation to the (simplified) ELF. Return -error | 31 | /* |
32 | or 0. */ | 32 | * Apply the given relocation to the (simplified) ELF. Return -error |
33 | * or 0. | ||
34 | */ | ||
35 | #ifdef CONFIG_MODULES_USE_ELF_REL | ||
33 | int apply_relocate(Elf_Shdr *sechdrs, | 36 | int apply_relocate(Elf_Shdr *sechdrs, |
34 | const char *strtab, | 37 | const char *strtab, |
35 | unsigned int symindex, | 38 | unsigned int symindex, |
36 | unsigned int relsec, | 39 | unsigned int relsec, |
37 | struct module *mod); | 40 | struct module *mod); |
41 | #else | ||
42 | static 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", me->name); | ||
49 | return -ENOEXEC; | ||
50 | } | ||
51 | #endif | ||
38 | 52 | ||
39 | /* Apply the given add relocation to the (simplified) ELF. Return | 53 | /* |
40 | -error or 0 */ | 54 | * Apply the given add relocation to the (simplified) ELF. Return |
55 | * -error or 0 | ||
56 | */ | ||
57 | #ifdef CONFIG_MODULES_USE_ELF_RELA | ||
41 | int apply_relocate_add(Elf_Shdr *sechdrs, | 58 | int apply_relocate_add(Elf_Shdr *sechdrs, |
42 | const char *strtab, | 59 | const char *strtab, |
43 | unsigned int symindex, | 60 | unsigned int symindex, |
44 | unsigned int relsec, | 61 | unsigned int relsec, |
45 | struct module *mod); | 62 | struct module *mod); |
63 | #else | ||
64 | static inline int apply_relocate_add(Elf_Shdr *sechdrs, | ||
65 | const char *strtab, | ||
66 | unsigned int symindex, | ||
67 | unsigned int relsec, | ||
68 | struct module *me) | ||
69 | { | ||
70 | printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name); | ||
71 | return -ENOEXEC; | ||
72 | } | ||
73 | #endif | ||
46 | 74 | ||
47 | /* Any final processing of module before access. Return -error or 0. */ | 75 | /* Any final processing of module before access. Return -error or 0. */ |
48 | int module_finalize(const Elf_Ehdr *hdr, | 76 | int module_finalize(const Elf_Ehdr *hdr, |