aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/module.c34
-rw-r--r--arch/arm/kernel/module.c29
-rw-r--r--arch/avr32/kernel/module.c20
-rw-r--r--arch/blackfin/kernel/module.c21
-rw-r--r--arch/cris/kernel/module.c43
-rw-r--r--arch/frv/kernel/module.c57
-rw-r--r--arch/h8300/kernel/module.c45
-rw-r--r--arch/ia64/kernel/module.c16
-rw-r--r--arch/m32r/kernel/module.c38
-rw-r--r--arch/m68k/kernel/module_mm.c27
-rw-r--r--arch/m68k/kernel/module_no.c34
-rw-r--r--arch/microblaze/kernel/module.c35
-rw-r--r--arch/mips/kernel/module.c20
-rw-r--r--arch/mn10300/kernel/module.c61
-rw-r--r--arch/parisc/kernel/module.c12
-rw-r--r--arch/powerpc/kernel/module.c18
-rw-r--r--arch/powerpc/kernel/module_32.c11
-rw-r--r--arch/powerpc/kernel/module_64.c10
-rw-r--r--arch/s390/kernel/module.c20
-rw-r--r--arch/score/kernel/module.c29
-rw-r--r--arch/sh/kernel/module.c35
-rw-r--r--arch/sparc/kernel/module.c28
-rw-r--r--arch/tile/kernel/module.c31
-rw-r--r--arch/unicore32/kernel/module.c35
-rw-r--r--arch/x86/kernel/module.c37
-rw-r--r--arch/xtensa/kernel/module.c43
26 files changed, 12 insertions, 777 deletions
diff --git a/arch/alpha/kernel/module.c b/arch/alpha/kernel/module.c
index ebc3c894b5a2..2fd00b7077e4 100644
--- a/arch/alpha/kernel/module.c
+++ b/arch/alpha/kernel/module.c
@@ -29,20 +29,6 @@
29#define DEBUGP(fmt...) 29#define DEBUGP(fmt...)
30#endif 30#endif
31 31
32void *
33module_alloc(unsigned long size)
34{
35 if (size == 0)
36 return NULL;
37 return vmalloc(size);
38}
39
40void
41module_free(struct module *mod, void *module_region)
42{
43 vfree(module_region);
44}
45
46/* Allocate the GOT at the end of the core sections. */ 32/* Allocate the GOT at the end of the core sections. */
47 33
48struct got_entry { 34struct got_entry {
@@ -156,14 +142,6 @@ module_frob_arch_sections(Elf64_Ehdr *hdr, Elf64_Shdr *sechdrs,
156} 142}
157 143
158int 144int
159apply_relocate(Elf64_Shdr *sechdrs, const char *strtab, unsigned int symindex,
160 unsigned int relsec, struct module *me)
161{
162 printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
163 return -ENOEXEC;
164}
165
166int
167apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab, 145apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab,
168 unsigned int symindex, unsigned int relsec, 146 unsigned int symindex, unsigned int relsec,
169 struct module *me) 147 struct module *me)
@@ -302,15 +280,3 @@ apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab,
302 280
303 return 0; 281 return 0;
304} 282}
305
306int
307module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
308 struct module *me)
309{
310 return 0;
311}
312
313void
314module_arch_cleanup(struct module *mod)
315{
316}
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index 016d6a0830a3..05b377616fd5 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -43,25 +43,7 @@ void *module_alloc(unsigned long size)
43 GFP_KERNEL, PAGE_KERNEL_EXEC, -1, 43 GFP_KERNEL, PAGE_KERNEL_EXEC, -1,
44 __builtin_return_address(0)); 44 __builtin_return_address(0));
45} 45}
46#else /* CONFIG_MMU */ 46#endif
47void *module_alloc(unsigned long size)
48{
49 return size == 0 ? NULL : vmalloc(size);
50}
51#endif /* !CONFIG_MMU */
52
53void module_free(struct module *module, void *region)
54{
55 vfree(region);
56}
57
58int module_frob_arch_sections(Elf_Ehdr *hdr,
59 Elf_Shdr *sechdrs,
60 char *secstrings,
61 struct module *mod)
62{
63 return 0;
64}
65 47
66int 48int
67apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, 49apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
@@ -265,15 +247,6 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
265 return 0; 247 return 0;
266} 248}
267 249
268int
269apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
270 unsigned int symindex, unsigned int relsec, struct module *module)
271{
272 printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n",
273 module->name);
274 return -ENOEXEC;
275}
276
277struct mod_unwind_map { 250struct mod_unwind_map {
278 const Elf_Shdr *unw_sec; 251 const Elf_Shdr *unw_sec;
279 const Elf_Shdr *txt_sec; 252 const Elf_Shdr *txt_sec;
diff --git a/arch/avr32/kernel/module.c b/arch/avr32/kernel/module.c
index a727f54d64d6..596f7305d93f 100644
--- a/arch/avr32/kernel/module.c
+++ b/arch/avr32/kernel/module.c
@@ -19,13 +19,6 @@
19#include <linux/moduleloader.h> 19#include <linux/moduleloader.h>
20#include <linux/vmalloc.h> 20#include <linux/vmalloc.h>
21 21
22void *module_alloc(unsigned long size)
23{
24 if (size == 0)
25 return NULL;
26 return vmalloc(size);
27}
28
29void module_free(struct module *mod, void *module_region) 22void module_free(struct module *mod, void *module_region)
30{ 23{
31 vfree(mod->arch.syminfo); 24 vfree(mod->arch.syminfo);
@@ -299,15 +292,6 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
299 return ret; 292 return ret;
300} 293}
301 294
302int apply_relocate(Elf32_Shdr *sechdrs, const char *strtab,
303 unsigned int symindex, unsigned int relindex,
304 struct module *module)
305{
306 printk(KERN_ERR "module %s: REL relocations are not supported\n",
307 module->name);
308 return -ENOEXEC;
309}
310
311int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, 295int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
312 struct module *module) 296 struct module *module)
313{ 297{
@@ -316,7 +300,3 @@ int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
316 300
317 return 0; 301 return 0;
318} 302}
319
320void module_arch_cleanup(struct module *module)
321{
322}
diff --git a/arch/blackfin/kernel/module.c b/arch/blackfin/kernel/module.c
index 35e350cad9d9..4489efc52883 100644
--- a/arch/blackfin/kernel/module.c
+++ b/arch/blackfin/kernel/module.c
@@ -16,19 +16,6 @@
16#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18 18
19void *module_alloc(unsigned long size)
20{
21 if (size == 0)
22 return NULL;
23 return vmalloc(size);
24}
25
26/* Free memory returned from module_alloc */
27void module_free(struct module *mod, void *module_region)
28{
29 vfree(module_region);
30}
31
32/* Transfer the section to the L1 memory */ 19/* Transfer the section to the L1 memory */
33int 20int
34module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, 21module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
@@ -150,14 +137,6 @@ module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
150 return 0; 137 return 0;
151} 138}
152 139
153int
154apply_relocate(Elf_Shdr * sechdrs, const char *strtab,
155 unsigned int symindex, unsigned int relsec, struct module *mod)
156{
157 pr_err(".rel unsupported\n");
158 return -ENOEXEC;
159}
160
161/*************************************************************************/ 140/*************************************************************************/
162/* FUNCTION : apply_relocate_add */ 141/* FUNCTION : apply_relocate_add */
163/* ABSTRACT : Blackfin specific relocation handling for the loadable */ 142/* ABSTRACT : Blackfin specific relocation handling for the loadable */
diff --git a/arch/cris/kernel/module.c b/arch/cris/kernel/module.c
index bcd502f74cda..37400f5869e6 100644
--- a/arch/cris/kernel/module.c
+++ b/arch/cris/kernel/module.c
@@ -30,45 +30,19 @@
30#endif 30#endif
31 31
32#ifdef CONFIG_ETRAX_KMALLOCED_MODULES 32#ifdef CONFIG_ETRAX_KMALLOCED_MODULES
33#define MALLOC_MODULE(size) kmalloc(size, GFP_KERNEL)
34#define FREE_MODULE(region) kfree(region)
35#else
36#define MALLOC_MODULE(size) vmalloc_exec(size)
37#define FREE_MODULE(region) vfree(region)
38#endif
39
40void *module_alloc(unsigned long size) 33void *module_alloc(unsigned long size)
41{ 34{
42 if (size == 0) 35 if (size == 0)
43 return NULL; 36 return NULL;
44 return MALLOC_MODULE(size); 37 return kmalloc(size, GFP_KERNEL);
45} 38}
46 39
47
48/* Free memory returned from module_alloc */ 40/* Free memory returned from module_alloc */
49void module_free(struct module *mod, void *module_region) 41void module_free(struct module *mod, void *module_region)
50{ 42{
51 FREE_MODULE(module_region); 43 kfree(module_region);
52}
53
54/* We don't need anything special. */
55int module_frob_arch_sections(Elf_Ehdr *hdr,
56 Elf_Shdr *sechdrs,
57 char *secstrings,
58 struct module *mod)
59{
60 return 0;
61}
62
63int apply_relocate(Elf32_Shdr *sechdrs,
64 const char *strtab,
65 unsigned int symindex,
66 unsigned int relsec,
67 struct module *me)
68{
69 printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
70 return -ENOEXEC;
71} 44}
45#endif
72 46
73int apply_relocate_add(Elf32_Shdr *sechdrs, 47int apply_relocate_add(Elf32_Shdr *sechdrs,
74 const char *strtab, 48 const char *strtab,
@@ -108,14 +82,3 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
108 82
109 return 0; 83 return 0;
110} 84}
111
112int module_finalize(const Elf_Ehdr *hdr,
113 const Elf_Shdr *sechdrs,
114 struct module *me)
115{
116 return 0;
117}
118
119void module_arch_cleanup(struct module *mod)
120{
121}
diff --git a/arch/frv/kernel/module.c b/arch/frv/kernel/module.c
index 711763c8a6f3..9d9835f1fe2b 100644
--- a/arch/frv/kernel/module.c
+++ b/arch/frv/kernel/module.c
@@ -22,57 +22,6 @@
22#define DEBUGP(fmt...) 22#define DEBUGP(fmt...)
23#endif 23#endif
24 24
25void *module_alloc(unsigned long size) 25/* TODO: At least one of apply_relocate or apply_relocate_add must be
26{ 26 * implemented in order to get working module support.
27 if (size == 0) 27 */
28 return NULL;
29
30 return vmalloc_exec(size);
31}
32
33
34/* Free memory returned from module_alloc */
35void module_free(struct module *mod, void *module_region)
36{
37 vfree(module_region);
38}
39
40/* We don't need anything special. */
41int module_frob_arch_sections(Elf_Ehdr *hdr,
42 Elf_Shdr *sechdrs,
43 char *secstrings,
44 struct module *mod)
45{
46 return 0;
47}
48
49int apply_relocate(Elf32_Shdr *sechdrs,
50 const char *strtab,
51 unsigned int symindex,
52 unsigned int relsec,
53 struct module *me)
54{
55 printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
56 return -ENOEXEC;
57}
58
59int apply_relocate_add(Elf32_Shdr *sechdrs,
60 const char *strtab,
61 unsigned int symindex,
62 unsigned int relsec,
63 struct module *me)
64{
65 printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
66 return -ENOEXEC;
67}
68
69int module_finalize(const Elf_Ehdr *hdr,
70 const Elf_Shdr *sechdrs,
71 struct module *me)
72{
73 return 0;
74}
75
76void module_arch_cleanup(struct module *mod)
77{
78}
diff --git a/arch/h8300/kernel/module.c b/arch/h8300/kernel/module.c
index db4953dc4e1b..1d526e05db19 100644
--- a/arch/h8300/kernel/module.c
+++ b/arch/h8300/kernel/module.c
@@ -11,40 +11,6 @@
11#define DEBUGP(fmt...) 11#define DEBUGP(fmt...)
12#endif 12#endif
13 13
14void *module_alloc(unsigned long size)
15{
16 if (size == 0)
17 return NULL;
18 return vmalloc(size);
19}
20
21
22/* Free memory returned from module_alloc */
23void module_free(struct module *mod, void *module_region)
24{
25 vfree(module_region);
26}
27
28/* We don't need anything special. */
29int module_frob_arch_sections(Elf_Ehdr *hdr,
30 Elf_Shdr *sechdrs,
31 char *secstrings,
32 struct module *mod)
33{
34 return 0;
35}
36
37int apply_relocate(Elf32_Shdr *sechdrs,
38 const char *strtab,
39 unsigned int symindex,
40 unsigned int relsec,
41 struct module *me)
42{
43 printk(KERN_ERR "module %s: RELOCATION unsupported\n",
44 me->name);
45 return -ENOEXEC;
46}
47
48int apply_relocate_add(Elf32_Shdr *sechdrs, 14int apply_relocate_add(Elf32_Shdr *sechdrs,
49 const char *strtab, 15 const char *strtab,
50 unsigned int symindex, 16 unsigned int symindex,
@@ -107,14 +73,3 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
107 me->name, rela[i].r_offset); 73 me->name, rela[i].r_offset);
108 return -ENOEXEC; 74 return -ENOEXEC;
109} 75}
110
111int module_finalize(const Elf_Ehdr *hdr,
112 const Elf_Shdr *sechdrs,
113 struct module *me)
114{
115 return 0;
116}
117
118void module_arch_cleanup(struct module *mod)
119{
120}
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
index 1481b0a28ca0..24603be24c14 100644
--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
@@ -304,14 +304,6 @@ plt_target (struct plt_entry *plt)
304 304
305#endif /* !USE_BRL */ 305#endif /* !USE_BRL */
306 306
307void *
308module_alloc (unsigned long size)
309{
310 if (!size)
311 return NULL;
312 return vmalloc(size);
313}
314
315void 307void
316module_free (struct module *mod, void *module_region) 308module_free (struct module *mod, void *module_region)
317{ 309{
@@ -853,14 +845,6 @@ apply_relocate_add (Elf64_Shdr *sechdrs, const char *strtab, unsigned int symind
853 return 0; 845 return 0;
854} 846}
855 847
856int
857apply_relocate (Elf64_Shdr *sechdrs, const char *strtab, unsigned int symindex,
858 unsigned int relsec, struct module *mod)
859{
860 printk(KERN_ERR "module %s: REL relocs in section %u unsupported\n", mod->name, relsec);
861 return -ENOEXEC;
862}
863
864/* 848/*
865 * Modules contain a single unwind table which covers both the core and the init text 849 * Modules contain a single unwind table which covers both the core and the init text
866 * sections but since the two are not contiguous, we need to split this table up such that 850 * sections but since the two are not contiguous, we need to split this table up such that
diff --git a/arch/m32r/kernel/module.c b/arch/m32r/kernel/module.c
index cb5f37d78d49..3071fe83ffc8 100644
--- a/arch/m32r/kernel/module.c
+++ b/arch/m32r/kernel/module.c
@@ -28,33 +28,6 @@
28#define DEBUGP(fmt...) 28#define DEBUGP(fmt...)
29#endif 29#endif
30 30
31void *module_alloc(unsigned long size)
32{
33 if (size == 0)
34 return NULL;
35#ifdef CONFIG_MMU
36 return vmalloc_exec(size);
37#else
38 return vmalloc(size);
39#endif
40}
41
42
43/* Free memory returned from module_alloc */
44void module_free(struct module *mod, void *module_region)
45{
46 vfree(module_region);
47}
48
49/* We don't need anything special. */
50int module_frob_arch_sections(Elf_Ehdr *hdr,
51 Elf_Shdr *sechdrs,
52 char *secstrings,
53 struct module *mod)
54{
55 return 0;
56}
57
58#define COPY_UNALIGNED_WORD(sw, tw, align) \ 31#define COPY_UNALIGNED_WORD(sw, tw, align) \
59{ \ 32{ \
60 void *__s = &(sw), *__t = &(tw); \ 33 void *__s = &(sw), *__t = &(tw); \
@@ -243,14 +216,3 @@ int apply_relocate(Elf32_Shdr *sechdrs,
243 return 0; 216 return 0;
244 217
245} 218}
246
247int module_finalize(const Elf_Ehdr *hdr,
248 const Elf_Shdr *sechdrs,
249 struct module *me)
250{
251 return 0;
252}
253
254void module_arch_cleanup(struct module *mod)
255{
256}
diff --git a/arch/m68k/kernel/module_mm.c b/arch/m68k/kernel/module_mm.c
index cd6bcb1c957e..ceafc47c96d5 100644
--- a/arch/m68k/kernel/module_mm.c
+++ b/arch/m68k/kernel/module_mm.c
@@ -19,29 +19,6 @@
19 19
20#ifdef CONFIG_MODULES 20#ifdef CONFIG_MODULES
21 21
22void *module_alloc(unsigned long size)
23{
24 if (size == 0)
25 return NULL;
26 return vmalloc(size);
27}
28
29
30/* Free memory returned from module_alloc */
31void module_free(struct module *mod, void *module_region)
32{
33 vfree(module_region);
34}
35
36/* We don't need anything special. */
37int module_frob_arch_sections(Elf_Ehdr *hdr,
38 Elf_Shdr *sechdrs,
39 char *secstrings,
40 struct module *mod)
41{
42 return 0;
43}
44
45int apply_relocate(Elf32_Shdr *sechdrs, 22int apply_relocate(Elf32_Shdr *sechdrs,
46 const char *strtab, 23 const char *strtab,
47 unsigned int symindex, 24 unsigned int symindex,
@@ -131,10 +108,6 @@ int module_finalize(const Elf_Ehdr *hdr,
131 return 0; 108 return 0;
132} 109}
133 110
134void module_arch_cleanup(struct module *mod)
135{
136}
137
138#endif /* CONFIG_MODULES */ 111#endif /* CONFIG_MODULES */
139 112
140void module_fixup(struct module *mod, struct m68k_fixup_info *start, 113void module_fixup(struct module *mod, struct m68k_fixup_info *start,
diff --git a/arch/m68k/kernel/module_no.c b/arch/m68k/kernel/module_no.c
index d11ffae7956a..5a097c6063fa 100644
--- a/arch/m68k/kernel/module_no.c
+++ b/arch/m68k/kernel/module_no.c
@@ -11,29 +11,6 @@
11#define DEBUGP(fmt...) 11#define DEBUGP(fmt...)
12#endif 12#endif
13 13
14void *module_alloc(unsigned long size)
15{
16 if (size == 0)
17 return NULL;
18 return vmalloc(size);
19}
20
21
22/* Free memory returned from module_alloc */
23void module_free(struct module *mod, void *module_region)
24{
25 vfree(module_region);
26}
27
28/* We don't need anything special. */
29int module_frob_arch_sections(Elf_Ehdr *hdr,
30 Elf_Shdr *sechdrs,
31 char *secstrings,
32 struct module *mod)
33{
34 return 0;
35}
36
37int apply_relocate(Elf32_Shdr *sechdrs, 14int apply_relocate(Elf32_Shdr *sechdrs,
38 const char *strtab, 15 const char *strtab,
39 unsigned int symindex, 16 unsigned int symindex,
@@ -113,14 +90,3 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
113 } 90 }
114 return 0; 91 return 0;
115} 92}
116
117int module_finalize(const Elf_Ehdr *hdr,
118 const Elf_Shdr *sechdrs,
119 struct module *me)
120{
121 return 0;
122}
123
124void module_arch_cleanup(struct module *mod)
125{
126}
diff --git a/arch/microblaze/kernel/module.c b/arch/microblaze/kernel/module.c
index 0e73f6606547..142426f631bb 100644
--- a/arch/microblaze/kernel/module.c
+++ b/arch/microblaze/kernel/module.c
@@ -18,37 +18,6 @@
18#include <asm/pgtable.h> 18#include <asm/pgtable.h>
19#include <asm/cacheflush.h> 19#include <asm/cacheflush.h>
20 20
21void *module_alloc(unsigned long size)
22{
23 void *ret;
24 ret = (size == 0) ? NULL : vmalloc(size);
25 pr_debug("module_alloc (%08lx@%08lx)\n", size, (unsigned long int)ret);
26 return ret;
27}
28
29void module_free(struct module *module, void *region)
30{
31 pr_debug("module_free(%s,%08lx)\n", module->name,
32 (unsigned long)region);
33 vfree(region);
34}
35
36int module_frob_arch_sections(Elf_Ehdr *hdr,
37 Elf_Shdr *sechdrs,
38 char *secstrings,
39 struct module *mod)
40{
41 return 0;
42}
43
44int apply_relocate(Elf32_Shdr *sechdrs, const char *strtab,
45 unsigned int symindex, unsigned int relsec, struct module *module)
46{
47 printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n",
48 module->name);
49 return -ENOEXEC;
50}
51
52int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, 21int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
53 unsigned int symindex, unsigned int relsec, struct module *module) 22 unsigned int symindex, unsigned int relsec, struct module *module)
54{ 23{
@@ -155,7 +124,3 @@ int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
155 flush_dcache(); 124 flush_dcache();
156 return 0; 125 return 0;
157} 126}
158
159void module_arch_cleanup(struct module *mod)
160{
161}
diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c
index dd940b701963..4b930ac4aff2 100644
--- a/arch/mips/kernel/module.c
+++ b/arch/mips/kernel/module.c
@@ -45,30 +45,14 @@ static struct mips_hi16 *mips_hi16_list;
45static LIST_HEAD(dbe_list); 45static LIST_HEAD(dbe_list);
46static DEFINE_SPINLOCK(dbe_lock); 46static DEFINE_SPINLOCK(dbe_lock);
47 47
48#ifdef MODULE_START
48void *module_alloc(unsigned long size) 49void *module_alloc(unsigned long size)
49{ 50{
50#ifdef MODULE_START
51 return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END, 51 return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END,
52 GFP_KERNEL, PAGE_KERNEL, -1, 52 GFP_KERNEL, PAGE_KERNEL, -1,
53 __builtin_return_address(0)); 53 __builtin_return_address(0));
54#else
55 if (size == 0)
56 return NULL;
57 return vmalloc(size);
58#endif
59}
60
61/* Free memory returned from module_alloc */
62void module_free(struct module *mod, void *module_region)
63{
64 vfree(module_region);
65}
66
67int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
68 char *secstrings, struct module *mod)
69{
70 return 0;
71} 54}
55#endif
72 56
73static int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v) 57static int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v)
74{ 58{
diff --git a/arch/mn10300/kernel/module.c b/arch/mn10300/kernel/module.c
index 196a111e2e29..216ad23c9570 100644
--- a/arch/mn10300/kernel/module.c
+++ b/arch/mn10300/kernel/module.c
@@ -32,36 +32,6 @@
32#define DEBUGP(fmt, ...) 32#define DEBUGP(fmt, ...)
33#endif 33#endif
34 34
35/*
36 * allocate storage for a module
37 */
38void *module_alloc(unsigned long size)
39{
40 if (size == 0)
41 return NULL;
42 return vmalloc_exec(size);
43}
44
45/*
46 * free memory returned from module_alloc()
47 */
48void module_free(struct module *mod, void *module_region)
49{
50 vfree(module_region);
51}
52
53/*
54 * allow the arch to fix up the section table
55 * - we don't need anything special
56 */
57int module_frob_arch_sections(Elf_Ehdr *hdr,
58 Elf_Shdr *sechdrs,
59 char *secstrings,
60 struct module *mod)
61{
62 return 0;
63}
64
65static void reloc_put16(uint8_t *p, uint32_t val) 35static void reloc_put16(uint8_t *p, uint32_t val)
66{ 36{
67 p[0] = val & 0xff; 37 p[0] = val & 0xff;
@@ -81,20 +51,6 @@ static void reloc_put32(uint8_t *p, uint32_t val)
81} 51}
82 52
83/* 53/*
84 * apply a REL relocation
85 */
86int apply_relocate(Elf32_Shdr *sechdrs,
87 const char *strtab,
88 unsigned int symindex,
89 unsigned int relsec,
90 struct module *me)
91{
92 printk(KERN_ERR "module %s: RELOCATION unsupported\n",
93 me->name);
94 return -ENOEXEC;
95}
96
97/*
98 * apply a RELA relocation 54 * apply a RELA relocation
99 */ 55 */
100int apply_relocate_add(Elf32_Shdr *sechdrs, 56int apply_relocate_add(Elf32_Shdr *sechdrs,
@@ -198,20 +154,3 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
198 } 154 }
199 return 0; 155 return 0;
200} 156}
201
202/*
203 * finish loading the module
204 */
205int module_finalize(const Elf_Ehdr *hdr,
206 const Elf_Shdr *sechdrs,
207 struct module *me)
208{
209 return 0;
210}
211
212/*
213 * finish clearing the module
214 */
215void module_arch_cleanup(struct module *mod)
216{
217}
diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
index cedbbb8b18d9..5e34ccf39a49 100644
--- a/arch/parisc/kernel/module.c
+++ b/arch/parisc/kernel/module.c
@@ -540,18 +540,6 @@ static Elf_Addr get_stub(struct module *me, unsigned long value, long addend,
540 return (Elf_Addr)stub; 540 return (Elf_Addr)stub;
541} 541}
542 542
543int apply_relocate(Elf_Shdr *sechdrs,
544 const char *strtab,
545 unsigned int symindex,
546 unsigned int relsec,
547 struct module *me)
548{
549 /* parisc should not need this ... */
550 printk(KERN_ERR "module %s: RELOCATION unsupported\n",
551 me->name);
552 return -ENOEXEC;
553}
554
555#ifndef CONFIG_64BIT 543#ifndef CONFIG_64BIT
556int apply_relocate_add(Elf_Shdr *sechdrs, 544int apply_relocate_add(Elf_Shdr *sechdrs,
557 const char *strtab, 545 const char *strtab,
diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c
index 49cee9df225b..a1cd701b5753 100644
--- a/arch/powerpc/kernel/module.c
+++ b/arch/powerpc/kernel/module.c
@@ -31,20 +31,6 @@
31 31
32LIST_HEAD(module_bug_list); 32LIST_HEAD(module_bug_list);
33 33
34void *module_alloc(unsigned long size)
35{
36 if (size == 0)
37 return NULL;
38
39 return vmalloc_exec(size);
40}
41
42/* Free memory returned from module_alloc */
43void module_free(struct module *mod, void *module_region)
44{
45 vfree(module_region);
46}
47
48static const Elf_Shdr *find_section(const Elf_Ehdr *hdr, 34static const Elf_Shdr *find_section(const Elf_Ehdr *hdr,
49 const Elf_Shdr *sechdrs, 35 const Elf_Shdr *sechdrs,
50 const char *name) 36 const char *name)
@@ -93,7 +79,3 @@ int module_finalize(const Elf_Ehdr *hdr,
93 79
94 return 0; 80 return 0;
95} 81}
96
97void module_arch_cleanup(struct module *mod)
98{
99}
diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c
index f832773fc28e..0b6d79617d7b 100644
--- a/arch/powerpc/kernel/module_32.c
+++ b/arch/powerpc/kernel/module_32.c
@@ -174,17 +174,6 @@ int module_frob_arch_sections(Elf32_Ehdr *hdr,
174 return 0; 174 return 0;
175} 175}
176 176
177int apply_relocate(Elf32_Shdr *sechdrs,
178 const char *strtab,
179 unsigned int symindex,
180 unsigned int relsec,
181 struct module *module)
182{
183 printk(KERN_ERR "%s: Non-ADD RELOCATION unsupported\n",
184 module->name);
185 return -ENOEXEC;
186}
187
188static inline int entry_matches(struct ppc_plt_entry *entry, Elf32_Addr val) 177static inline int entry_matches(struct ppc_plt_entry *entry, Elf32_Addr val)
189{ 178{
190 if (entry->jump[0] == 0x3d600000 + ((val + 0x8000) >> 16) 179 if (entry->jump[0] == 0x3d600000 + ((val + 0x8000) >> 16)
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index 8fbb12508bf3..9f44a775a106 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -243,16 +243,6 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr,
243 return 0; 243 return 0;
244} 244}
245 245
246int apply_relocate(Elf64_Shdr *sechdrs,
247 const char *strtab,
248 unsigned int symindex,
249 unsigned int relsec,
250 struct module *me)
251{
252 printk(KERN_ERR "%s: Non-ADD RELOCATION unsupported\n", me->name);
253 return -ENOEXEC;
254}
255
256/* r2 is the TOC pointer: it actually points 0x8000 into the TOC (this 246/* r2 is the TOC pointer: it actually points 0x8000 into the TOC (this
257 gives the value maximum span in an instruction which uses a signed 247 gives the value maximum span in an instruction which uses a signed
258 offset) */ 248 offset) */
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
index f7167ee4604c..dfcb3436bad0 100644
--- a/arch/s390/kernel/module.c
+++ b/arch/s390/kernel/module.c
@@ -45,13 +45,6 @@
45#define PLT_ENTRY_SIZE 20 45#define PLT_ENTRY_SIZE 20
46#endif /* CONFIG_64BIT */ 46#endif /* CONFIG_64BIT */
47 47
48void *module_alloc(unsigned long size)
49{
50 if (size == 0)
51 return NULL;
52 return vmalloc(size);
53}
54
55/* Free memory returned from module_alloc */ 48/* Free memory returned from module_alloc */
56void module_free(struct module *mod, void *module_region) 49void module_free(struct module *mod, void *module_region)
57{ 50{
@@ -176,15 +169,6 @@ module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
176 return 0; 169 return 0;
177} 170}
178 171
179int
180apply_relocate(Elf_Shdr *sechdrs, const char *strtab, unsigned int symindex,
181 unsigned int relsec, struct module *me)
182{
183 printk(KERN_ERR "module %s: RELOCATION unsupported\n",
184 me->name);
185 return -ENOEXEC;
186}
187
188static int 172static int
189apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab, 173apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
190 struct module *me) 174 struct module *me)
@@ -409,7 +393,3 @@ int module_finalize(const Elf_Ehdr *hdr,
409 me->arch.syminfo = NULL; 393 me->arch.syminfo = NULL;
410 return 0; 394 return 0;
411} 395}
412
413void module_arch_cleanup(struct module *mod)
414{
415}
diff --git a/arch/score/kernel/module.c b/arch/score/kernel/module.c
index 4de8d47becd3..469e3b64e2f2 100644
--- a/arch/score/kernel/module.c
+++ b/arch/score/kernel/module.c
@@ -27,23 +27,6 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/vmalloc.h> 28#include <linux/vmalloc.h>
29 29
30void *module_alloc(unsigned long size)
31{
32 return size ? vmalloc(size) : NULL;
33}
34
35/* Free memory returned from module_alloc */
36void module_free(struct module *mod, void *module_region)
37{
38 vfree(module_region);
39}
40
41int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
42 char *secstrings, struct module *mod)
43{
44 return 0;
45}
46
47int apply_relocate(Elf_Shdr *sechdrs, const char *strtab, 30int apply_relocate(Elf_Shdr *sechdrs, const char *strtab,
48 unsigned int symindex, unsigned int relindex, 31 unsigned int symindex, unsigned int relindex,
49 struct module *me) 32 struct module *me)
@@ -146,6 +129,9 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
146 unsigned int symindex, unsigned int relsec, 129 unsigned int symindex, unsigned int relsec,
147 struct module *me) 130 struct module *me)
148{ 131{
132 /* Non-standard return value... most other arch's return -ENOEXEC
133 * for an unsupported relocation variant
134 */
149 return 0; 135 return 0;
150} 136}
151 137
@@ -154,12 +140,3 @@ const struct exception_table_entry *search_module_dbetables(unsigned long addr)
154{ 140{
155 return NULL; 141 return NULL;
156} 142}
157
158/* Put in dbe list if necessary. */
159int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
160 struct module *me)
161{
162 return 0;
163}
164
165void module_arch_cleanup(struct module *mod) {}
diff --git a/arch/sh/kernel/module.c b/arch/sh/kernel/module.c
index 19b1f8826aef..1b525dedd29a 100644
--- a/arch/sh/kernel/module.c
+++ b/arch/sh/kernel/module.c
@@ -34,30 +34,6 @@
34#include <asm/unaligned.h> 34#include <asm/unaligned.h>
35#include <asm/dwarf.h> 35#include <asm/dwarf.h>
36 36
37void *module_alloc(unsigned long size)
38{
39 if (size == 0)
40 return NULL;
41
42 return vmalloc_exec(size);
43}
44
45
46/* Free memory returned from module_alloc */
47void module_free(struct module *mod, void *module_region)
48{
49 vfree(module_region);
50}
51
52/* We don't need anything special. */
53int module_frob_arch_sections(Elf_Ehdr *hdr,
54 Elf_Shdr *sechdrs,
55 char *secstrings,
56 struct module *mod)
57{
58 return 0;
59}
60
61int apply_relocate_add(Elf32_Shdr *sechdrs, 37int apply_relocate_add(Elf32_Shdr *sechdrs,
62 const char *strtab, 38 const char *strtab,
63 unsigned int symindex, 39 unsigned int symindex,
@@ -133,17 +109,6 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
133 return 0; 109 return 0;
134} 110}
135 111
136int apply_relocate(Elf32_Shdr *sechdrs,
137 const char *strtab,
138 unsigned int symindex,
139 unsigned int relsec,
140 struct module *me)
141{
142 printk(KERN_ERR "module %s: REL RELOCATION unsupported\n",
143 me->name);
144 return -ENOEXEC;
145}
146
147int module_finalize(const Elf_Ehdr *hdr, 112int module_finalize(const Elf_Ehdr *hdr,
148 const Elf_Shdr *sechdrs, 113 const Elf_Shdr *sechdrs,
149 struct module *me) 114 struct module *me)
diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
index 99ba5baa9497..da0c6c70ccb2 100644
--- a/arch/sparc/kernel/module.c
+++ b/arch/sparc/kernel/module.c
@@ -68,12 +68,6 @@ void *module_alloc(unsigned long size)
68 return ret; 68 return ret;
69} 69}
70 70
71/* Free memory returned from module_core_alloc/module_init_alloc */
72void module_free(struct module *mod, void *module_region)
73{
74 vfree(module_region);
75}
76
77/* Make generic code ignore STT_REGISTER dummy undefined symbols. */ 71/* Make generic code ignore STT_REGISTER dummy undefined symbols. */
78int module_frob_arch_sections(Elf_Ehdr *hdr, 72int module_frob_arch_sections(Elf_Ehdr *hdr,
79 Elf_Shdr *sechdrs, 73 Elf_Shdr *sechdrs,
@@ -107,17 +101,6 @@ int module_frob_arch_sections(Elf_Ehdr *hdr,
107 return 0; 101 return 0;
108} 102}
109 103
110int apply_relocate(Elf_Shdr *sechdrs,
111 const char *strtab,
112 unsigned int symindex,
113 unsigned int relsec,
114 struct module *me)
115{
116 printk(KERN_ERR "module %s: non-ADD RELOCATION unsupported\n",
117 me->name);
118 return -ENOEXEC;
119}
120
121int apply_relocate_add(Elf_Shdr *sechdrs, 104int apply_relocate_add(Elf_Shdr *sechdrs,
122 const char *strtab, 105 const char *strtab,
123 unsigned int symindex, 106 unsigned int symindex,
@@ -239,15 +222,4 @@ int module_finalize(const Elf_Ehdr *hdr,
239 222
240 return 0; 223 return 0;
241} 224}
242#else
243int module_finalize(const Elf_Ehdr *hdr,
244 const Elf_Shdr *sechdrs,
245 struct module *me)
246{
247 return 0;
248}
249#endif /* CONFIG_SPARC64 */ 225#endif /* CONFIG_SPARC64 */
250
251void module_arch_cleanup(struct module *mod)
252{
253}
diff --git a/arch/tile/kernel/module.c b/arch/tile/kernel/module.c
index f68df69f1f67..28fa6ece9d3a 100644
--- a/arch/tile/kernel/module.c
+++ b/arch/tile/kernel/module.c
@@ -98,25 +98,6 @@ void module_free(struct module *mod, void *module_region)
98 */ 98 */
99} 99}
100 100
101/* We don't need anything special. */
102int module_frob_arch_sections(Elf_Ehdr *hdr,
103 Elf_Shdr *sechdrs,
104 char *secstrings,
105 struct module *mod)
106{
107 return 0;
108}
109
110int apply_relocate(Elf_Shdr *sechdrs,
111 const char *strtab,
112 unsigned int symindex,
113 unsigned int relsec,
114 struct module *me)
115{
116 pr_err("module %s: .rel relocation unsupported\n", me->name);
117 return -ENOEXEC;
118}
119
120#ifdef __tilegx__ 101#ifdef __tilegx__
121/* 102/*
122 * Validate that the high 16 bits of "value" is just the sign-extension of 103 * Validate that the high 16 bits of "value" is just the sign-extension of
@@ -249,15 +230,3 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
249 } 230 }
250 return 0; 231 return 0;
251} 232}
252
253int module_finalize(const Elf_Ehdr *hdr,
254 const Elf_Shdr *sechdrs,
255 struct module *me)
256{
257 /* FIXME: perhaps remove the "writable" bit from the TLB? */
258 return 0;
259}
260
261void module_arch_cleanup(struct module *mod)
262{
263}
diff --git a/arch/unicore32/kernel/module.c b/arch/unicore32/kernel/module.c
index 3e5a38d71a1e..8fbe8577f5e6 100644
--- a/arch/unicore32/kernel/module.c
+++ b/arch/unicore32/kernel/module.c
@@ -37,19 +37,6 @@ void *module_alloc(unsigned long size)
37 return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL_EXEC); 37 return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL_EXEC);
38} 38}
39 39
40void module_free(struct module *module, void *region)
41{
42 vfree(region);
43}
44
45int module_frob_arch_sections(Elf_Ehdr *hdr,
46 Elf_Shdr *sechdrs,
47 char *secstrings,
48 struct module *mod)
49{
50 return 0;
51}
52
53int 40int
54apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, 41apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
55 unsigned int relindex, struct module *module) 42 unsigned int relindex, struct module *module)
@@ -128,25 +115,3 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
128 } 115 }
129 return 0; 116 return 0;
130} 117}
131
132int
133apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
134 unsigned int symindex, unsigned int relsec,
135 struct module *module)
136{
137 printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n",
138 module->name);
139 return -ENOEXEC;
140}
141
142int
143module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
144 struct module *module)
145{
146 return 0;
147}
148
149void
150module_arch_cleanup(struct module *mod)
151{
152}
diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c
index 52f256f2cc81..925179f871de 100644
--- a/arch/x86/kernel/module.c
+++ b/arch/x86/kernel/module.c
@@ -45,21 +45,6 @@ void *module_alloc(unsigned long size)
45 -1, __builtin_return_address(0)); 45 -1, __builtin_return_address(0));
46} 46}
47 47
48/* Free memory returned from module_alloc */
49void module_free(struct module *mod, void *module_region)
50{
51 vfree(module_region);
52}
53
54/* We don't need anything special. */
55int module_frob_arch_sections(Elf_Ehdr *hdr,
56 Elf_Shdr *sechdrs,
57 char *secstrings,
58 struct module *mod)
59{
60 return 0;
61}
62
63#ifdef CONFIG_X86_32 48#ifdef CONFIG_X86_32
64int apply_relocate(Elf32_Shdr *sechdrs, 49int apply_relocate(Elf32_Shdr *sechdrs,
65 const char *strtab, 50 const char *strtab,
@@ -100,17 +85,6 @@ int apply_relocate(Elf32_Shdr *sechdrs,
100 } 85 }
101 return 0; 86 return 0;
102} 87}
103
104int apply_relocate_add(Elf32_Shdr *sechdrs,
105 const char *strtab,
106 unsigned int symindex,
107 unsigned int relsec,
108 struct module *me)
109{
110 printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n",
111 me->name);
112 return -ENOEXEC;
113}
114#else /*X86_64*/ 88#else /*X86_64*/
115int apply_relocate_add(Elf64_Shdr *sechdrs, 89int apply_relocate_add(Elf64_Shdr *sechdrs,
116 const char *strtab, 90 const char *strtab,
@@ -181,17 +155,6 @@ overflow:
181 me->name); 155 me->name);
182 return -ENOEXEC; 156 return -ENOEXEC;
183} 157}
184
185int apply_relocate(Elf_Shdr *sechdrs,
186 const char *strtab,
187 unsigned int symindex,
188 unsigned int relsec,
189 struct module *me)
190{
191 printk(KERN_ERR "non add relocation not supported\n");
192 return -ENOSYS;
193}
194
195#endif 158#endif
196 159
197int module_finalize(const Elf_Ehdr *hdr, 160int module_finalize(const Elf_Ehdr *hdr,
diff --git a/arch/xtensa/kernel/module.c b/arch/xtensa/kernel/module.c
index c1accea8cb56..451dda928c93 100644
--- a/arch/xtensa/kernel/module.c
+++ b/arch/xtensa/kernel/module.c
@@ -24,26 +24,6 @@
24 24
25#undef DEBUG_RELOCATE 25#undef DEBUG_RELOCATE
26 26
27void *module_alloc(unsigned long size)
28{
29 if (size == 0)
30 return NULL;
31 return vmalloc_exec(size);
32}
33
34void module_free(struct module *mod, void *module_region)
35{
36 vfree(module_region);
37}
38
39int module_frob_arch_sections(Elf32_Ehdr *hdr,
40 Elf32_Shdr *sechdrs,
41 char *secstrings,
42 struct module *mod)
43{
44 return 0;
45}
46
47static int 27static int
48decode_calln_opcode (unsigned char *location) 28decode_calln_opcode (unsigned char *location)
49{ 29{
@@ -66,18 +46,6 @@ decode_l32r_opcode (unsigned char *location)
66#endif 46#endif
67} 47}
68 48
69int apply_relocate(Elf32_Shdr *sechdrs,
70 const char *strtab,
71 unsigned int symindex,
72 unsigned int relsec,
73 struct module *mod)
74{
75 printk(KERN_ERR "module %s: REL RELOCATION unsupported\n",
76 mod->name);
77 return -ENOEXEC;
78
79}
80
81int apply_relocate_add(Elf32_Shdr *sechdrs, 49int apply_relocate_add(Elf32_Shdr *sechdrs,
82 const char *strtab, 50 const char *strtab,
83 unsigned int symindex, 51 unsigned int symindex,
@@ -222,14 +190,3 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
222 } 190 }
223 return 0; 191 return 0;
224} 192}
225
226int module_finalize(const Elf_Ehdr *hdr,
227 const Elf_Shdr *sechdrs,
228 struct module *mod)
229{
230 return 0;
231}
232
233void module_arch_cleanup(struct module *mod)
234{
235}