aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/Kconfig19
-rw-r--r--arch/alpha/Kconfig2
-rw-r--r--arch/alpha/include/asm/module.h10
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm/include/asm/module.h8
-rw-r--r--arch/avr32/Kconfig2
-rw-r--r--arch/avr32/include/asm/module.h6
-rw-r--r--arch/blackfin/Kconfig2
-rw-r--r--arch/blackfin/include/asm/module.h4
-rw-r--r--arch/c6x/Kconfig1
-rw-r--r--arch/c6x/include/asm/module.h12
-rw-r--r--arch/cris/Kconfig1
-rw-r--r--arch/cris/include/asm/Kbuild2
-rw-r--r--arch/cris/include/asm/module.h9
-rw-r--r--arch/frv/include/asm/module.h8
-rw-r--r--arch/h8300/Kconfig1
-rw-r--r--arch/h8300/include/asm/Kbuild2
-rw-r--r--arch/h8300/include/asm/module.h11
-rw-r--r--arch/hexagon/Kconfig1
-rw-r--r--arch/ia64/Kconfig2
-rw-r--r--arch/ia64/include/asm/module.h6
-rw-r--r--arch/m32r/Kconfig1
-rw-r--r--arch/m32r/include/asm/Kbuild2
-rw-r--r--arch/m32r/include/asm/module.h10
-rw-r--r--arch/m32r/kernel/module.c15
-rw-r--r--arch/m68k/Kconfig3
-rw-r--r--arch/m68k/include/asm/module.h6
-rw-r--r--arch/microblaze/Kconfig1
-rw-r--r--arch/mips/Kconfig3
-rw-r--r--arch/mips/include/asm/module.h10
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mn10300/Kconfig1
-rw-r--r--arch/mn10300/include/asm/module.h7
-rw-r--r--arch/openrisc/Kconfig1
-rw-r--r--arch/parisc/Kconfig2
-rw-r--r--arch/parisc/include/asm/module.h16
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/include/asm/module.h7
-rw-r--r--arch/s390/Kconfig2
-rw-r--r--arch/s390/include/asm/module.h18
-rw-r--r--arch/score/Kconfig2
-rw-r--r--arch/score/include/asm/module.h6
-rw-r--r--arch/score/kernel/module.c10
-rw-r--r--arch/sh/Kconfig2
-rw-r--r--arch/sh/include/asm/module.h14
-rw-r--r--arch/sparc/Kconfig1
-rw-r--r--arch/sparc/include/asm/Kbuild1
-rw-r--r--arch/sparc/include/asm/module.h24
-rw-r--r--arch/tile/Kconfig1
-rw-r--r--arch/unicore32/Kconfig1
-rw-r--r--arch/x86/Kconfig2
-rw-r--r--arch/x86/um/Kconfig2
-rw-r--r--arch/xtensa/Kconfig1
-rw-r--r--arch/xtensa/include/asm/module.h9
-rw-r--r--include/asm-generic/module.h40
-rw-r--r--include/linux/moduleloader.h36
-rw-r--r--kernel/module.c20
57 files changed, 168 insertions, 224 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index 72f2fa189cc5..3450115c6437 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -281,4 +281,23 @@ config SECCOMP_FILTER
281 281
282 See Documentation/prctl/seccomp_filter.txt for details. 282 See Documentation/prctl/seccomp_filter.txt for details.
283 283
284config HAVE_MOD_ARCH_SPECIFIC
285 bool
286 help
287 The arch uses struct mod_arch_specific to store data. Many arches
288 just need a simple module loader without arch specific data - those
289 should not enable this.
290
291config MODULES_USE_ELF_RELA
292 bool
293 help
294 Modules only use ELF RELA relocations. Modules with ELF REL
295 relocations will give an error.
296
297config MODULES_USE_ELF_REL
298 bool
299 help
300 Modules only use ELF REL relocations. Modules with ELF RELA
301 relocations will give an error.
302
284source "kernel/gcov/Kconfig" 303source "kernel/gcov/Kconfig"
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 9944dedee5b1..7e3710c0cce5 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -20,6 +20,8 @@ config ALPHA
20 select GENERIC_CMOS_UPDATE 20 select GENERIC_CMOS_UPDATE
21 select GENERIC_STRNCPY_FROM_USER 21 select GENERIC_STRNCPY_FROM_USER
22 select GENERIC_STRNLEN_USER 22 select GENERIC_STRNLEN_USER
23 select HAVE_MOD_ARCH_SPECIFIC
24 select MODULES_USE_ELF_RELA
23 help 25 help
24 The Alpha is a 64-bit general-purpose processor designed and 26 The Alpha is a 64-bit general-purpose processor designed and
25 marketed by the Digital Equipment Corporation of blessed memory, 27 marketed by the Digital Equipment Corporation of blessed memory,
diff --git a/arch/alpha/include/asm/module.h b/arch/alpha/include/asm/module.h
index 7b63743c534a..9cd13b55155f 100644
--- a/arch/alpha/include/asm/module.h
+++ b/arch/alpha/include/asm/module.h
@@ -1,19 +1,13 @@
1#ifndef _ALPHA_MODULE_H 1#ifndef _ALPHA_MODULE_H
2#define _ALPHA_MODULE_H 2#define _ALPHA_MODULE_H
3 3
4#include <asm-generic/module.h>
5
4struct mod_arch_specific 6struct mod_arch_specific
5{ 7{
6 unsigned int gotsecindex; 8 unsigned int gotsecindex;
7}; 9};
8 10
9#define Elf_Sym Elf64_Sym
10#define Elf_Shdr Elf64_Shdr
11#define Elf_Ehdr Elf64_Ehdr
12#define Elf_Phdr Elf64_Phdr
13#define Elf_Dyn Elf64_Dyn
14#define Elf_Rel Elf64_Rel
15#define Elf_Rela Elf64_Rela
16
17#define ARCH_SHF_SMALL SHF_ALPHA_GPREL 11#define ARCH_SHF_SMALL SHF_ALPHA_GPREL
18 12
19#ifdef MODULE 13#ifdef MODULE
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 2f88d8d97701..7a08b3a71c01 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -49,6 +49,8 @@ config ARM
49 select GENERIC_STRNCPY_FROM_USER 49 select GENERIC_STRNCPY_FROM_USER
50 select GENERIC_STRNLEN_USER 50 select GENERIC_STRNLEN_USER
51 select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN 51 select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN
52 select HAVE_MOD_ARCH_SPECIFIC if ARM_UNWIND
53 select MODULES_USE_ELF_REL
52 help 54 help
53 The ARM series is a line of low-power-consumption RISC chip designs 55 The ARM series is a line of low-power-consumption RISC chip designs
54 licensed by ARM Ltd and targeted at embedded applications and 56 licensed by ARM Ltd and targeted at embedded applications and
diff --git a/arch/arm/include/asm/module.h b/arch/arm/include/asm/module.h
index 6c6809f982f1..0d3a28dbc8e5 100644
--- a/arch/arm/include/asm/module.h
+++ b/arch/arm/include/asm/module.h
@@ -1,9 +1,7 @@
1#ifndef _ASM_ARM_MODULE_H 1#ifndef _ASM_ARM_MODULE_H
2#define _ASM_ARM_MODULE_H 2#define _ASM_ARM_MODULE_H
3 3
4#define Elf_Shdr Elf32_Shdr 4#include <asm-generic/module.h>
5#define Elf_Sym Elf32_Sym
6#define Elf_Ehdr Elf32_Ehdr
7 5
8struct unwind_table; 6struct unwind_table;
9 7
@@ -16,13 +14,11 @@ enum {
16 ARM_SEC_DEVEXIT, 14 ARM_SEC_DEVEXIT,
17 ARM_SEC_MAX, 15 ARM_SEC_MAX,
18}; 16};
19#endif
20 17
21struct mod_arch_specific { 18struct mod_arch_specific {
22#ifdef CONFIG_ARM_UNWIND
23 struct unwind_table *unwind[ARM_SEC_MAX]; 19 struct unwind_table *unwind[ARM_SEC_MAX];
24#endif
25}; 20};
21#endif
26 22
27/* 23/*
28 * Add the ARM architecture version to the version magic string 24 * Add the ARM architecture version to the version magic string
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index 5ade51c8a87f..06e73bf665e9 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -15,6 +15,8 @@ config AVR32
15 select ARCH_WANT_IPC_PARSE_VERSION 15 select ARCH_WANT_IPC_PARSE_VERSION
16 select ARCH_HAVE_NMI_SAFE_CMPXCHG 16 select ARCH_HAVE_NMI_SAFE_CMPXCHG
17 select GENERIC_CLOCKEVENTS 17 select GENERIC_CLOCKEVENTS
18 select HAVE_MOD_ARCH_SPECIFIC
19 select MODULES_USE_ELF_RELA
18 help 20 help
19 AVR32 is a high-performance 32-bit RISC microprocessor core, 21 AVR32 is a high-performance 32-bit RISC microprocessor core,
20 designed for cost-sensitive embedded applications, with particular 22 designed for cost-sensitive embedded applications, with particular
diff --git a/arch/avr32/include/asm/module.h b/arch/avr32/include/asm/module.h
index 451444538a1b..3f083d385a64 100644
--- a/arch/avr32/include/asm/module.h
+++ b/arch/avr32/include/asm/module.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_AVR32_MODULE_H 1#ifndef __ASM_AVR32_MODULE_H
2#define __ASM_AVR32_MODULE_H 2#define __ASM_AVR32_MODULE_H
3 3
4#include <asm-generic/module.h>
5
4struct mod_arch_syminfo { 6struct mod_arch_syminfo {
5 unsigned long got_offset; 7 unsigned long got_offset;
6 int got_initialized; 8 int got_initialized;
@@ -17,10 +19,6 @@ struct mod_arch_specific {
17 struct mod_arch_syminfo *syminfo; 19 struct mod_arch_syminfo *syminfo;
18}; 20};
19 21
20#define Elf_Shdr Elf32_Shdr
21#define Elf_Sym Elf32_Sym
22#define Elf_Ehdr Elf32_Ehdr
23
24#define MODULE_PROC_FAMILY "AVR32v1" 22#define MODULE_PROC_FAMILY "AVR32v1"
25 23
26#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY 24#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index c7092e6057c5..8e82e267b897 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -42,6 +42,8 @@ config BLACKFIN
42 select HAVE_NMI_WATCHDOG if NMI_WATCHDOG 42 select HAVE_NMI_WATCHDOG if NMI_WATCHDOG
43 select GENERIC_SMP_IDLE_THREAD 43 select GENERIC_SMP_IDLE_THREAD
44 select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS 44 select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS
45 select HAVE_MOD_ARCH_SPECIFIC
46 select MODULES_USE_ELF_RELA
45 47
46config GENERIC_CSUM 48config GENERIC_CSUM
47 def_bool y 49 def_bool y
diff --git a/arch/blackfin/include/asm/module.h b/arch/blackfin/include/asm/module.h
index ed5689b82c9f..231a149b3f77 100644
--- a/arch/blackfin/include/asm/module.h
+++ b/arch/blackfin/include/asm/module.h
@@ -7,9 +7,7 @@
7#ifndef _ASM_BFIN_MODULE_H 7#ifndef _ASM_BFIN_MODULE_H
8#define _ASM_BFIN_MODULE_H 8#define _ASM_BFIN_MODULE_H
9 9
10#define Elf_Shdr Elf32_Shdr 10#include <asm-generic/module.h>
11#define Elf_Sym Elf32_Sym
12#define Elf_Ehdr Elf32_Ehdr
13 11
14struct mod_arch_specific { 12struct mod_arch_specific {
15 Elf_Shdr *text_l1; 13 Elf_Shdr *text_l1;
diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig
index 983c859e40b7..f6a3648f5ec3 100644
--- a/arch/c6x/Kconfig
+++ b/arch/c6x/Kconfig
@@ -17,6 +17,7 @@ config C6X
17 select OF 17 select OF
18 select OF_EARLY_FLATTREE 18 select OF_EARLY_FLATTREE
19 select GENERIC_CLOCKEVENTS 19 select GENERIC_CLOCKEVENTS
20 select MODULES_USE_ELF_RELA
20 21
21config MMU 22config MMU
22 def_bool n 23 def_bool n
diff --git a/arch/c6x/include/asm/module.h b/arch/c6x/include/asm/module.h
index a453f9744f42..5c7269c7ef73 100644
--- a/arch/c6x/include/asm/module.h
+++ b/arch/c6x/include/asm/module.h
@@ -13,17 +13,7 @@
13#ifndef _ASM_C6X_MODULE_H 13#ifndef _ASM_C6X_MODULE_H
14#define _ASM_C6X_MODULE_H 14#define _ASM_C6X_MODULE_H
15 15
16#define Elf_Shdr Elf32_Shdr 16#include <asm-generic/module.h>
17#define Elf_Sym Elf32_Sym
18#define Elf_Ehdr Elf32_Ehdr
19#define Elf_Addr Elf32_Addr
20#define Elf_Word Elf32_Word
21
22/*
23 * This file contains the C6x architecture specific module code.
24 */
25struct mod_arch_specific {
26};
27 17
28struct loaded_sections { 18struct loaded_sections {
29 unsigned int new_vaddr; 19 unsigned int new_vaddr;
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index e92215428a37..7bb8cf90e6aa 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -47,6 +47,7 @@ config CRIS
47 select GENERIC_IOMAP 47 select GENERIC_IOMAP
48 select GENERIC_SMP_IDLE_THREAD if ETRAX_ARCH_V32 48 select GENERIC_SMP_IDLE_THREAD if ETRAX_ARCH_V32
49 select GENERIC_CMOS_UPDATE 49 select GENERIC_CMOS_UPDATE
50 select MODULES_USE_ELF_RELA
50 51
51config HZ 52config HZ
52 int 53 int
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index 04d02a51c5e9..28b690de7971 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -7,3 +7,5 @@ header-y += ethernet.h
7header-y += etraxgpio.h 7header-y += etraxgpio.h
8header-y += rs485.h 8header-y += rs485.h
9header-y += sync_serial.h 9header-y += sync_serial.h
10
11generic-y += module.h
diff --git a/arch/cris/include/asm/module.h b/arch/cris/include/asm/module.h
deleted file mode 100644
index 7ee72311bd78..000000000000
--- a/arch/cris/include/asm/module.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _ASM_CRIS_MODULE_H
2#define _ASM_CRIS_MODULE_H
3/* cris is simple */
4struct mod_arch_specific { };
5
6#define Elf_Shdr Elf32_Shdr
7#define Elf_Sym Elf32_Sym
8#define Elf_Ehdr Elf32_Ehdr
9#endif /* _ASM_CRIS_MODULE_H */
diff --git a/arch/frv/include/asm/module.h b/arch/frv/include/asm/module.h
index 3d5c6360289a..a8848f09a217 100644
--- a/arch/frv/include/asm/module.h
+++ b/arch/frv/include/asm/module.h
@@ -11,13 +11,7 @@
11#ifndef _ASM_MODULE_H 11#ifndef _ASM_MODULE_H
12#define _ASM_MODULE_H 12#define _ASM_MODULE_H
13 13
14struct mod_arch_specific 14#include <asm-generic/module.h>
15{
16};
17
18#define Elf_Shdr Elf32_Shdr
19#define Elf_Sym Elf32_Sym
20#define Elf_Ehdr Elf32_Ehdr
21 15
22/* 16/*
23 * Include the architecture version. 17 * Include the architecture version.
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 5e8a0d9a09ce..c149d3b29eb6 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -6,6 +6,7 @@ config H8300
6 select ARCH_WANT_IPC_PARSE_VERSION 6 select ARCH_WANT_IPC_PARSE_VERSION
7 select GENERIC_IRQ_SHOW 7 select GENERIC_IRQ_SHOW
8 select GENERIC_CPU_DEVICES 8 select GENERIC_CPU_DEVICES
9 select MODULES_USE_ELF_RELA
9 10
10config SYMBOL_PREFIX 11config SYMBOL_PREFIX
11 string 12 string
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild
index c68e1680da01..871382d239fe 100644
--- a/arch/h8300/include/asm/Kbuild
+++ b/arch/h8300/include/asm/Kbuild
@@ -1 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2
3generic-y += module.h
diff --git a/arch/h8300/include/asm/module.h b/arch/h8300/include/asm/module.h
deleted file mode 100644
index 8e46724b7c09..000000000000
--- a/arch/h8300/include/asm/module.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _ASM_H8300_MODULE_H
2#define _ASM_H8300_MODULE_H
3/*
4 * This file contains the H8/300 architecture specific module code.
5 */
6struct mod_arch_specific { };
7#define Elf_Shdr Elf32_Shdr
8#define Elf_Sym Elf32_Sym
9#define Elf_Ehdr Elf32_Ehdr
10
11#endif /* _ASM_H8/300_MODULE_H */
diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index b2fdfb700f50..0744f7d7b1fd 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -30,6 +30,7 @@ config HEXAGON
30 select KTIME_SCALAR 30 select KTIME_SCALAR
31 select GENERIC_CLOCKEVENTS 31 select GENERIC_CLOCKEVENTS
32 select GENERIC_CLOCKEVENTS_BROADCAST 32 select GENERIC_CLOCKEVENTS_BROADCAST
33 select MODULES_USE_ELF_RELA
33 ---help--- 34 ---help---
34 Qualcomm Hexagon is a processor architecture designed for high 35 Qualcomm Hexagon is a processor architecture designed for high
35 performance and low power across a wide variety of applications. 36 performance and low power across a wide variety of applications.
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 310cf5781fad..688146466d0d 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -39,6 +39,8 @@ config IA64
39 select ARCH_THREAD_INFO_ALLOCATOR 39 select ARCH_THREAD_INFO_ALLOCATOR
40 select ARCH_CLOCKSOURCE_DATA 40 select ARCH_CLOCKSOURCE_DATA
41 select GENERIC_TIME_VSYSCALL 41 select GENERIC_TIME_VSYSCALL
42 select HAVE_MOD_ARCH_SPECIFIC
43 select MODULES_USE_ELF_RELA
42 default y 44 default y
43 help 45 help
44 The Itanium Processor Family is Intel's 64-bit successor to 46 The Itanium Processor Family is Intel's 64-bit successor to
diff --git a/arch/ia64/include/asm/module.h b/arch/ia64/include/asm/module.h
index 908eaef42a08..dfba22a872c3 100644
--- a/arch/ia64/include/asm/module.h
+++ b/arch/ia64/include/asm/module.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_IA64_MODULE_H 1#ifndef _ASM_IA64_MODULE_H
2#define _ASM_IA64_MODULE_H 2#define _ASM_IA64_MODULE_H
3 3
4#include <asm-generic/module.h>
5
4/* 6/*
5 * IA-64-specific support for kernel module loader. 7 * IA-64-specific support for kernel module loader.
6 * 8 *
@@ -29,10 +31,6 @@ struct mod_arch_specific {
29 unsigned int next_got_entry; /* index of next available got entry */ 31 unsigned int next_got_entry; /* index of next available got entry */
30}; 32};
31 33
32#define Elf_Shdr Elf64_Shdr
33#define Elf_Sym Elf64_Sym
34#define Elf_Ehdr Elf64_Ehdr
35
36#define MODULE_PROC_FAMILY "ia64" 34#define MODULE_PROC_FAMILY "ia64"
37#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY \ 35#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY \
38 "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__) 36 "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__)
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 49498bbb9616..fc6153361bf5 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -13,6 +13,7 @@ config M32R
13 select GENERIC_IRQ_SHOW 13 select GENERIC_IRQ_SHOW
14 select GENERIC_ATOMIC64 14 select GENERIC_ATOMIC64
15 select ARCH_USES_GETTIMEOFFSET 15 select ARCH_USES_GETTIMEOFFSET
16 select MODULES_USE_ELF_RELA
16 17
17config SBUS 18config SBUS
18 bool 19 bool
diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild
index c68e1680da01..871382d239fe 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -1 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2
3generic-y += module.h
diff --git a/arch/m32r/include/asm/module.h b/arch/m32r/include/asm/module.h
deleted file mode 100644
index eb73ee011215..000000000000
--- a/arch/m32r/include/asm/module.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _ASM_M32R_MODULE_H
2#define _ASM_M32R_MODULE_H
3
4struct mod_arch_specific { };
5
6#define Elf_Shdr Elf32_Shdr
7#define Elf_Sym Elf32_Sym
8#define Elf_Ehdr Elf32_Ehdr
9
10#endif /* _ASM_M32R_MODULE_H */
diff --git a/arch/m32r/kernel/module.c b/arch/m32r/kernel/module.c
index 3071fe83ffc8..38233b6596b6 100644
--- a/arch/m32r/kernel/module.c
+++ b/arch/m32r/kernel/module.c
@@ -201,18 +201,3 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
201 } 201 }
202 return 0; 202 return 0;
203} 203}
204
205int apply_relocate(Elf32_Shdr *sechdrs,
206 const char *strtab,
207 unsigned int symindex,
208 unsigned int relsec,
209 struct module *me)
210{
211#if 0
212 printk(KERN_ERR "module %s: REL RELOCATION unsupported\n",
213 me->name);
214 return -ENOEXEC;
215#endif
216 return 0;
217
218}
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index b22df9410dce..0df07cee3faf 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -13,6 +13,9 @@ config M68K
13 select FPU if MMU 13 select FPU if MMU
14 select ARCH_WANT_IPC_PARSE_VERSION 14 select ARCH_WANT_IPC_PARSE_VERSION
15 select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE 15 select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE
16 select HAVE_MOD_ARCH_SPECIFIC
17 select MODULES_USE_ELF_REL
18 select MODULES_USE_ELF_RELA
16 19
17config RWSEM_GENERIC_SPINLOCK 20config RWSEM_GENERIC_SPINLOCK
18 bool 21 bool
diff --git a/arch/m68k/include/asm/module.h b/arch/m68k/include/asm/module.h
index edffe66b7f49..8b58fce843dd 100644
--- a/arch/m68k/include/asm/module.h
+++ b/arch/m68k/include/asm/module.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_M68K_MODULE_H 1#ifndef _ASM_M68K_MODULE_H
2#define _ASM_M68K_MODULE_H 2#define _ASM_M68K_MODULE_H
3 3
4#include <asm-generic/module.h>
5
4enum m68k_fixup_type { 6enum m68k_fixup_type {
5 m68k_fixup_memoffset, 7 m68k_fixup_memoffset,
6 m68k_fixup_vnode_shift, 8 m68k_fixup_vnode_shift,
@@ -36,8 +38,4 @@ struct module;
36extern void module_fixup(struct module *mod, struct m68k_fixup_info *start, 38extern void module_fixup(struct module *mod, struct m68k_fixup_info *start,
37 struct m68k_fixup_info *end); 39 struct m68k_fixup_info *end);
38 40
39#define Elf_Shdr Elf32_Shdr
40#define Elf_Sym Elf32_Sym
41#define Elf_Ehdr Elf32_Ehdr
42
43#endif /* _ASM_M68K_MODULE_H */ 41#endif /* _ASM_M68K_MODULE_H */
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index ab9afcaa7f6a..b4f409f942ab 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -24,6 +24,7 @@ config MICROBLAZE
24 select GENERIC_CPU_DEVICES 24 select GENERIC_CPU_DEVICES
25 select GENERIC_ATOMIC64 25 select GENERIC_ATOMIC64
26 select GENERIC_CLOCKEVENTS 26 select GENERIC_CLOCKEVENTS
27 select MODULES_USE_ELF_RELA
27 28
28config SWAP 29config SWAP
29 def_bool n 30 def_bool n
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index faf65286574e..dccdfcd9e18e 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -36,6 +36,9 @@ config MIPS
36 select BUILDTIME_EXTABLE_SORT 36 select BUILDTIME_EXTABLE_SORT
37 select GENERIC_CLOCKEVENTS 37 select GENERIC_CLOCKEVENTS
38 select GENERIC_CMOS_UPDATE 38 select GENERIC_CMOS_UPDATE
39 select HAVE_MOD_ARCH_SPECIFIC
40 select MODULES_USE_ELF_REL
41 select MODULES_USE_ELF_RELA if 64BIT
39 42
40menu "Machine selection" 43menu "Machine selection"
41 44
diff --git a/arch/mips/include/asm/module.h b/arch/mips/include/asm/module.h
index dca8bce8c7ab..26137da1c713 100644
--- a/arch/mips/include/asm/module.h
+++ b/arch/mips/include/asm/module.h
@@ -35,11 +35,14 @@ typedef struct {
35} Elf64_Mips_Rela; 35} Elf64_Mips_Rela;
36 36
37#ifdef CONFIG_32BIT 37#ifdef CONFIG_32BIT
38
39#define Elf_Shdr Elf32_Shdr 38#define Elf_Shdr Elf32_Shdr
40#define Elf_Sym Elf32_Sym 39#define Elf_Sym Elf32_Sym
41#define Elf_Ehdr Elf32_Ehdr 40#define Elf_Ehdr Elf32_Ehdr
42#define Elf_Addr Elf32_Addr 41#define Elf_Addr Elf32_Addr
42#define Elf_Rel Elf32_Rel
43#define Elf_Rela Elf32_Rela
44#define ELF_R_TYPE(X) ELF32_R_TYPE(X)
45#define ELF_R_SYM(X) ELF32_R_SYM(X)
43 46
44#define Elf_Mips_Rel Elf32_Rel 47#define Elf_Mips_Rel Elf32_Rel
45#define Elf_Mips_Rela Elf32_Rela 48#define Elf_Mips_Rela Elf32_Rela
@@ -50,11 +53,14 @@ typedef struct {
50#endif 53#endif
51 54
52#ifdef CONFIG_64BIT 55#ifdef CONFIG_64BIT
53
54#define Elf_Shdr Elf64_Shdr 56#define Elf_Shdr Elf64_Shdr
55#define Elf_Sym Elf64_Sym 57#define Elf_Sym Elf64_Sym
56#define Elf_Ehdr Elf64_Ehdr 58#define Elf_Ehdr Elf64_Ehdr
57#define Elf_Addr Elf64_Addr 59#define Elf_Addr Elf64_Addr
60#define Elf_Rel Elf64_Rel
61#define Elf_Rela Elf64_Rela
62#define ELF_R_TYPE(X) ELF64_R_TYPE(X)
63#define ELF_R_SYM(X) ELF64_R_SYM(X)
58 64
59#define Elf_Mips_Rel Elf64_Mips_Rel 65#define Elf_Mips_Rel Elf64_Mips_Rel
60#define Elf_Mips_Rela Elf64_Mips_Rela 66#define Elf_Mips_Rela Elf64_Mips_Rela
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index e2c14999839a..cd1e6c2421b2 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -31,7 +31,7 @@ obj-$(CONFIG_SYNC_R4K) += sync-r4k.o
31 31
32obj-$(CONFIG_STACKTRACE) += stacktrace.o 32obj-$(CONFIG_STACKTRACE) += stacktrace.o
33obj-$(CONFIG_MODULES) += mips_ksyms.o module.o 33obj-$(CONFIG_MODULES) += mips_ksyms.o module.o
34obj-$(CONFIG_MODULES) += module-rela.o 34obj-$(CONFIG_MODULES_USE_ELF_RELA) += module-rela.o
35 35
36obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o 36obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o
37 37
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 5cfb086b3903..aa03f2e13385 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -8,6 +8,7 @@ config MN10300
8 select HAVE_ARCH_KGDB 8 select HAVE_ARCH_KGDB
9 select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER 9 select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER
10 select GENERIC_CLOCKEVENTS 10 select GENERIC_CLOCKEVENTS
11 select MODULES_USE_ELF_RELA
11 12
12config AM33_2 13config AM33_2
13 def_bool n 14 def_bool n
diff --git a/arch/mn10300/include/asm/module.h b/arch/mn10300/include/asm/module.h
index 5d7057d01494..6571103b0518 100644
--- a/arch/mn10300/include/asm/module.h
+++ b/arch/mn10300/include/asm/module.h
@@ -12,12 +12,7 @@
12#ifndef _ASM_MODULE_H 12#ifndef _ASM_MODULE_H
13#define _ASM_MODULE_H 13#define _ASM_MODULE_H
14 14
15struct mod_arch_specific { 15#include <asm-generic/module.h>
16};
17
18#define Elf_Shdr Elf32_Shdr
19#define Elf_Sym Elf32_Sym
20#define Elf_Ehdr Elf32_Ehdr
21 16
22/* 17/*
23 * Include the MN10300 architecture version. 18 * Include the MN10300 architecture version.
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 49765b53f637..05f2ba41ff1a 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -21,6 +21,7 @@ config OPENRISC
21 select GENERIC_CLOCKEVENTS 21 select GENERIC_CLOCKEVENTS
22 select GENERIC_STRNCPY_FROM_USER 22 select GENERIC_STRNCPY_FROM_USER
23 select GENERIC_STRNLEN_USER 23 select GENERIC_STRNLEN_USER
24 select MODULES_USE_ELF_RELA
24 25
25config MMU 26config MMU
26 def_bool y 27 def_bool y
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 3ff21b536f28..166d9911bc83 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -19,6 +19,8 @@ config PARISC
19 select ARCH_HAVE_NMI_SAFE_CMPXCHG 19 select ARCH_HAVE_NMI_SAFE_CMPXCHG
20 select GENERIC_SMP_IDLE_THREAD 20 select GENERIC_SMP_IDLE_THREAD
21 select GENERIC_STRNCPY_FROM_USER 21 select GENERIC_STRNCPY_FROM_USER
22 select HAVE_MOD_ARCH_SPECIFIC
23 select MODULES_USE_ELF_RELA
22 24
23 help 25 help
24 The PA-RISC microprocessor is designed by Hewlett-Packard and used 26 The PA-RISC microprocessor is designed by Hewlett-Packard and used
diff --git a/arch/parisc/include/asm/module.h b/arch/parisc/include/asm/module.h
index 1f4123427ea0..bab37e99168a 100644
--- a/arch/parisc/include/asm/module.h
+++ b/arch/parisc/include/asm/module.h
@@ -1,21 +1,11 @@
1#ifndef _ASM_PARISC_MODULE_H 1#ifndef _ASM_PARISC_MODULE_H
2#define _ASM_PARISC_MODULE_H 2#define _ASM_PARISC_MODULE_H
3
4#include <asm-generic/module.h>
5
3/* 6/*
4 * This file contains the parisc architecture specific module code. 7 * This file contains the parisc architecture specific module code.
5 */ 8 */
6#ifdef CONFIG_64BIT
7#define Elf_Shdr Elf64_Shdr
8#define Elf_Sym Elf64_Sym
9#define Elf_Ehdr Elf64_Ehdr
10#define Elf_Addr Elf64_Addr
11#define Elf_Rela Elf64_Rela
12#else
13#define Elf_Shdr Elf32_Shdr
14#define Elf_Sym Elf32_Sym
15#define Elf_Ehdr Elf32_Ehdr
16#define Elf_Addr Elf32_Addr
17#define Elf_Rela Elf32_Rela
18#endif
19 9
20struct unwind_table; 10struct unwind_table;
21 11
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 352f416269ce..74f84781b484 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -139,6 +139,8 @@ config PPC
139 select GENERIC_CLOCKEVENTS 139 select GENERIC_CLOCKEVENTS
140 select GENERIC_STRNCPY_FROM_USER 140 select GENERIC_STRNCPY_FROM_USER
141 select GENERIC_STRNLEN_USER 141 select GENERIC_STRNLEN_USER
142 select HAVE_MOD_ARCH_SPECIFIC
143 select MODULES_USE_ELF_RELA
142 144
143config EARLY_PRINTK 145config EARLY_PRINTK
144 bool 146 bool
diff --git a/arch/powerpc/include/asm/module.h b/arch/powerpc/include/asm/module.h
index 0192a4ee2bc2..c1df590ec444 100644
--- a/arch/powerpc/include/asm/module.h
+++ b/arch/powerpc/include/asm/module.h
@@ -11,6 +11,7 @@
11 11
12#include <linux/list.h> 12#include <linux/list.h>
13#include <asm/bug.h> 13#include <asm/bug.h>
14#include <asm-generic/module.h>
14 15
15 16
16#ifndef __powerpc64__ 17#ifndef __powerpc64__
@@ -60,16 +61,10 @@ struct mod_arch_specific {
60 */ 61 */
61 62
62#ifdef __powerpc64__ 63#ifdef __powerpc64__
63# define Elf_Shdr Elf64_Shdr
64# define Elf_Sym Elf64_Sym
65# define Elf_Ehdr Elf64_Ehdr
66# ifdef MODULE 64# ifdef MODULE
67 asm(".section .stubs,\"ax\",@nobits; .align 3; .previous"); 65 asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
68# endif 66# endif
69#else 67#else
70# define Elf_Shdr Elf32_Shdr
71# define Elf_Sym Elf32_Sym
72# define Elf_Ehdr Elf32_Ehdr
73# ifdef MODULE 68# ifdef MODULE
74 asm(".section .plt,\"ax\",@nobits; .align 3; .previous"); 69 asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
75 asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous"); 70 asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 107610e01a29..c76a052f60e2 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -125,6 +125,8 @@ config S390
125 select GENERIC_CLOCKEVENTS 125 select GENERIC_CLOCKEVENTS
126 select KTIME_SCALAR if 32BIT 126 select KTIME_SCALAR if 32BIT
127 select HAVE_ARCH_SECCOMP_FILTER 127 select HAVE_ARCH_SECCOMP_FILTER
128 select HAVE_MOD_ARCH_SPECIFIC
129 select MODULES_USE_ELF_RELA
128 130
129config SCHED_OMIT_FRAME_POINTER 131config SCHED_OMIT_FRAME_POINTER
130 def_bool y 132 def_bool y
diff --git a/arch/s390/include/asm/module.h b/arch/s390/include/asm/module.h
index f0b6b26b6e59..df1f861a848a 100644
--- a/arch/s390/include/asm/module.h
+++ b/arch/s390/include/asm/module.h
@@ -1,5 +1,8 @@
1#ifndef _ASM_S390_MODULE_H 1#ifndef _ASM_S390_MODULE_H
2#define _ASM_S390_MODULE_H 2#define _ASM_S390_MODULE_H
3
4#include <asm-generic/module.h>
5
3/* 6/*
4 * This file contains the s390 architecture specific module code. 7 * This file contains the s390 architecture specific module code.
5 */ 8 */
@@ -28,19 +31,4 @@ struct mod_arch_specific
28 struct mod_arch_syminfo *syminfo; 31 struct mod_arch_syminfo *syminfo;
29}; 32};
30 33
31#ifdef CONFIG_64BIT
32#define ElfW(x) Elf64_ ## x
33#define ELFW(x) ELF64_ ## x
34#else
35#define ElfW(x) Elf32_ ## x
36#define ELFW(x) ELF32_ ## x
37#endif
38
39#define Elf_Addr ElfW(Addr)
40#define Elf_Rela ElfW(Rela)
41#define Elf_Shdr ElfW(Shdr)
42#define Elf_Sym ElfW(Sym)
43#define Elf_Ehdr ElfW(Ehdr)
44#define ELF_R_SYM ELFW(R_SYM)
45#define ELF_R_TYPE ELFW(R_TYPE)
46#endif /* _ASM_S390_MODULE_H */ 34#endif /* _ASM_S390_MODULE_H */
diff --git a/arch/score/Kconfig b/arch/score/Kconfig
index ba0f412920be..e2c8db4533dc 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -10,6 +10,8 @@ config SCORE
10 select ARCH_DISCARD_MEMBLOCK 10 select ARCH_DISCARD_MEMBLOCK
11 select GENERIC_CPU_DEVICES 11 select GENERIC_CPU_DEVICES
12 select GENERIC_CLOCKEVENTS 12 select GENERIC_CLOCKEVENTS
13 select HAVE_MOD_ARCH_SPECIFIC
14 select MODULES_USE_ELF_REL
13 15
14choice 16choice
15 prompt "System type" 17 prompt "System type"
diff --git a/arch/score/include/asm/module.h b/arch/score/include/asm/module.h
index f0b5dc0bd023..abf395bbfaba 100644
--- a/arch/score/include/asm/module.h
+++ b/arch/score/include/asm/module.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <asm/uaccess.h> 5#include <asm/uaccess.h>
6#include <asm-generic/module.h>
6 7
7struct mod_arch_specific { 8struct mod_arch_specific {
8 /* Data Bus Error exception tables */ 9 /* Data Bus Error exception tables */
@@ -13,11 +14,6 @@ struct mod_arch_specific {
13 14
14typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */ 15typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */
15 16
16#define Elf_Shdr Elf32_Shdr
17#define Elf_Sym Elf32_Sym
18#define Elf_Ehdr Elf32_Ehdr
19#define Elf_Addr Elf32_Addr
20
21/* Given an address, look for it in the exception tables. */ 17/* Given an address, look for it in the exception tables. */
22#ifdef CONFIG_MODULES 18#ifdef CONFIG_MODULES
23const struct exception_table_entry *search_module_dbetables(unsigned long addr); 19const struct exception_table_entry *search_module_dbetables(unsigned long addr);
diff --git a/arch/score/kernel/module.c b/arch/score/kernel/module.c
index 469e3b64e2f2..1378d99baa3d 100644
--- a/arch/score/kernel/module.c
+++ b/arch/score/kernel/module.c
@@ -125,16 +125,6 @@ int apply_relocate(Elf_Shdr *sechdrs, const char *strtab,
125 return 0; 125 return 0;
126} 126}
127 127
128int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
129 unsigned int symindex, unsigned int relsec,
130 struct module *me)
131{
132 /* Non-standard return value... most other arch's return -ENOEXEC
133 * for an unsupported relocation variant
134 */
135 return 0;
136}
137
138/* Given an address, look for it in the module exception tables. */ 128/* Given an address, look for it in the module exception tables. */
139const struct exception_table_entry *search_module_dbetables(unsigned long addr) 129const struct exception_table_entry *search_module_dbetables(unsigned long addr)
140{ 130{
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 36f5141e8041..656329a9a59b 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -35,6 +35,8 @@ config SUPERH
35 select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST 35 select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
36 select GENERIC_STRNCPY_FROM_USER 36 select GENERIC_STRNCPY_FROM_USER
37 select GENERIC_STRNLEN_USER 37 select GENERIC_STRNLEN_USER
38 select HAVE_MOD_ARCH_SPECIFIC if DWARF_UNWINDER
39 select MODULES_USE_ELF_RELA
38 help 40 help
39 The SuperH is a RISC processor targeted for use in embedded systems 41 The SuperH is a RISC processor targeted for use in embedded systems
40 and consumer electronics; it was also used in the Sega Dreamcast 42 and consumer electronics; it was also used in the Sega Dreamcast
diff --git a/arch/sh/include/asm/module.h b/arch/sh/include/asm/module.h
index b7927de86f9f..81300d8b5448 100644
--- a/arch/sh/include/asm/module.h
+++ b/arch/sh/include/asm/module.h
@@ -1,21 +1,13 @@
1#ifndef _ASM_SH_MODULE_H 1#ifndef _ASM_SH_MODULE_H
2#define _ASM_SH_MODULE_H 2#define _ASM_SH_MODULE_H
3 3
4struct mod_arch_specific { 4#include <asm-generic/module.h>
5
5#ifdef CONFIG_DWARF_UNWINDER 6#ifdef CONFIG_DWARF_UNWINDER
7struct mod_arch_specific {
6 struct list_head fde_list; 8 struct list_head fde_list;
7 struct list_head cie_list; 9 struct list_head cie_list;
8#endif
9}; 10};
10
11#ifdef CONFIG_64BIT
12#define Elf_Shdr Elf64_Shdr
13#define Elf_Sym Elf64_Sym
14#define Elf_Ehdr Elf64_Ehdr
15#else
16#define Elf_Shdr Elf32_Shdr
17#define Elf_Sym Elf32_Sym
18#define Elf_Ehdr Elf32_Ehdr
19#endif 11#endif
20 12
21#ifdef CONFIG_CPU_LITTLE_ENDIAN 13#ifdef CONFIG_CPU_LITTLE_ENDIAN
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 67f1f6f5f4e1..a244e70b9bb0 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -37,6 +37,7 @@ config SPARC
37 select GENERIC_CLOCKEVENTS 37 select GENERIC_CLOCKEVENTS
38 select GENERIC_STRNCPY_FROM_USER 38 select GENERIC_STRNCPY_FROM_USER
39 select GENERIC_STRNLEN_USER 39 select GENERIC_STRNLEN_USER
40 select MODULES_USE_ELF_RELA
40 41
41config SPARC32 42config SPARC32
42 def_bool !64BIT 43 def_bool !64BIT
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 67f83e0a0d68..fbe1cb578fcd 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -21,4 +21,5 @@ generic-y += div64.h
21generic-y += local64.h 21generic-y += local64.h
22generic-y += irq_regs.h 22generic-y += irq_regs.h
23generic-y += local.h 23generic-y += local.h
24generic-y += module.h
24generic-y += word-at-a-time.h 25generic-y += word-at-a-time.h
diff --git a/arch/sparc/include/asm/module.h b/arch/sparc/include/asm/module.h
deleted file mode 100644
index ff8e02d80334..000000000000
--- a/arch/sparc/include/asm/module.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef __SPARC_MODULE_H
2#define __SPARC_MODULE_H
3struct mod_arch_specific { };
4
5/*
6 * Use some preprocessor magic to define the correct symbol
7 * for sparc32 and sparc64.
8 * Elf_Addr becomes Elf32_Addr for sparc32 and Elf64_Addr for sparc64
9 */
10#define ___ELF(a, b, c) a##b##c
11#define __ELF(a, b, c) ___ELF(a, b, c)
12#define _Elf(t) __ELF(Elf, CONFIG_BITS, t)
13#define _ELF(t) __ELF(ELF, CONFIG_BITS, t)
14
15#define Elf_Shdr _Elf(_Shdr)
16#define Elf_Sym _Elf(_Sym)
17#define Elf_Ehdr _Elf(_Ehdr)
18#define Elf_Rela _Elf(_Rela)
19#define Elf_Addr _Elf(_Addr)
20
21#define ELF_R_SYM _ELF(_R_SYM)
22#define ELF_R_TYPE _ELF(_R_TYPE)
23
24#endif /* __SPARC_MODULE_H */
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 932e4430f7f3..1603f3043399 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -17,6 +17,7 @@ config TILE
17 select SYS_HYPERVISOR 17 select SYS_HYPERVISOR
18 select ARCH_HAVE_NMI_SAFE_CMPXCHG 18 select ARCH_HAVE_NMI_SAFE_CMPXCHG
19 select GENERIC_CLOCKEVENTS 19 select GENERIC_CLOCKEVENTS
20 select MODULES_USE_ELF_RELA
20 21
21# FIXME: investigate whether we need/want these options. 22# FIXME: investigate whether we need/want these options.
22# select HAVE_IOREMAP_PROT 23# select HAVE_IOREMAP_PROT
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
index b0a47433341e..5ef081475bba 100644
--- a/arch/unicore32/Kconfig
+++ b/arch/unicore32/Kconfig
@@ -14,6 +14,7 @@ config UNICORE32
14 select GENERIC_IRQ_SHOW 14 select GENERIC_IRQ_SHOW
15 select ARCH_WANT_FRAME_POINTERS 15 select ARCH_WANT_FRAME_POINTERS
16 select GENERIC_IOMAP 16 select GENERIC_IOMAP
17 select MODULES_USE_ELF_REL
17 help 18 help
18 UniCore-32 is 32-bit Instruction Set Architecture, 19 UniCore-32 is 32-bit Instruction Set Architecture,
19 including a series of low-power-consumption RISC chip 20 including a series of low-power-consumption RISC chip
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 8ec3a1aa4abd..01726cbcc73b 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -97,6 +97,8 @@ config X86
97 select KTIME_SCALAR if X86_32 97 select KTIME_SCALAR if X86_32
98 select GENERIC_STRNCPY_FROM_USER 98 select GENERIC_STRNCPY_FROM_USER
99 select GENERIC_STRNLEN_USER 99 select GENERIC_STRNLEN_USER
100 select MODULES_USE_ELF_REL if X86_32
101 select MODULES_USE_ELF_RELA if X86_64
100 102
101config INSTRUCTION_DECODER 103config INSTRUCTION_DECODER
102 def_bool (KPROBES || PERF_EVENTS || UPROBES) 104 def_bool (KPROBES || PERF_EVENTS || UPROBES)
diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig
index 9926e11a772d..a4b0c10c9d5d 100644
--- a/arch/x86/um/Kconfig
+++ b/arch/x86/um/Kconfig
@@ -21,9 +21,11 @@ config 64BIT
21config X86_32 21config X86_32
22 def_bool !64BIT 22 def_bool !64BIT
23 select HAVE_AOUT 23 select HAVE_AOUT
24 select MODULES_USE_ELF_REL
24 25
25config X86_64 26config X86_64
26 def_bool 64BIT 27 def_bool 64BIT
28 select MODULES_USE_ELF_RELA
27 29
28config RWSEM_XCHGADD_ALGORITHM 30config RWSEM_XCHGADD_ALGORITHM
29 def_bool X86_XADD && 64BIT 31 def_bool X86_XADD && 64BIT
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 8ed64cfae4ff..4816e44001f1 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -11,6 +11,7 @@ config XTENSA
11 select HAVE_GENERIC_HARDIRQS 11 select HAVE_GENERIC_HARDIRQS
12 select GENERIC_IRQ_SHOW 12 select GENERIC_IRQ_SHOW
13 select GENERIC_CPU_DEVICES 13 select GENERIC_CPU_DEVICES
14 select MODULES_USE_ELF_RELA
14 help 15 help
15 Xtensa processors are 32-bit RISC machines designed by Tensilica 16 Xtensa processors are 32-bit RISC machines designed by Tensilica
16 primarily for embedded systems. These processors are both 17 primarily for embedded systems. These processors are both
diff --git a/arch/xtensa/include/asm/module.h b/arch/xtensa/include/asm/module.h
index d9b34bee4d42..488b40c6f9b9 100644
--- a/arch/xtensa/include/asm/module.h
+++ b/arch/xtensa/include/asm/module.h
@@ -13,15 +13,8 @@
13#ifndef _XTENSA_MODULE_H 13#ifndef _XTENSA_MODULE_H
14#define _XTENSA_MODULE_H 14#define _XTENSA_MODULE_H
15 15
16struct mod_arch_specific
17{
18 /* No special elements, yet. */
19};
20
21#define MODULE_ARCH_VERMAGIC "xtensa-" __stringify(XCHAL_CORE_ID) " " 16#define MODULE_ARCH_VERMAGIC "xtensa-" __stringify(XCHAL_CORE_ID) " "
22 17
23#define Elf_Shdr Elf32_Shdr 18#include <asm-generic/module.h>
24#define Elf_Sym Elf32_Sym
25#define Elf_Ehdr Elf32_Ehdr
26 19
27#endif /* _XTENSA_MODULE_H */ 20#endif /* _XTENSA_MODULE_H */
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
8struct mod_arch_specific 9struct 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. */
29void module_free(struct module *mod, void *module_region); 29void 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
33int apply_relocate(Elf_Shdr *sechdrs, 36int 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
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", 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
41int apply_relocate_add(Elf_Shdr *sechdrs, 58int 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
64static 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. */
48int module_finalize(const Elf_Ehdr *hdr, 76int module_finalize(const Elf_Ehdr *hdr,
diff --git a/kernel/module.c b/kernel/module.c
index 9ad9ee9406d6..7f2ee45f362c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1949,26 +1949,6 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)
1949 return ret; 1949 return ret;
1950} 1950}
1951 1951
1952int __weak apply_relocate(Elf_Shdr *sechdrs,
1953 const char *strtab,
1954 unsigned int symindex,
1955 unsigned int relsec,
1956 struct module *me)
1957{
1958 pr_err("module %s: REL relocation unsupported\n", me->name);
1959 return -ENOEXEC;
1960}
1961
1962int __weak apply_relocate_add(Elf_Shdr *sechdrs,
1963 const char *strtab,
1964 unsigned int symindex,
1965 unsigned int relsec,
1966 struct module *me)
1967{
1968 pr_err("module %s: RELA relocation unsupported\n", me->name);
1969 return -ENOEXEC;
1970}
1971
1972static int apply_relocations(struct module *mod, const struct load_info *info) 1952static int apply_relocations(struct module *mod, const struct load_info *info)
1973{ 1953{
1974 unsigned int i; 1954 unsigned int i;