aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-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/Kbuild1
-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/Kbuild1
-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/Kbuild1
-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/Makefile1
-rw-r--r--arch/mips/kernel/module-rela.c145
-rw-r--r--arch/mips/kernel/module.c121
-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/include/asm/module.h9
55 files changed, 245 insertions, 312 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index a79a1ad8bb96..366ec06a5185 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -322,4 +322,23 @@ config HAVE_IRQ_TIME_ACCOUNTING
322config HAVE_ARCH_TRANSPARENT_HUGEPAGE 322config HAVE_ARCH_TRANSPARENT_HUGEPAGE
323 bool 323 bool
324 324
325config HAVE_MOD_ARCH_SPECIFIC
326 bool
327 help
328 The arch uses struct mod_arch_specific to store data. Many arches
329 just need a simple module loader without arch specific data - those
330 should not enable this.
331
332config MODULES_USE_ELF_RELA
333 bool
334 help
335 Modules only use ELF RELA relocations. Modules with ELF REL
336 relocations will give an error.
337
338config MODULES_USE_ELF_REL
339 bool
340 help
341 Modules only use ELF REL relocations. Modules with ELF RELA
342 relocations will give an error.
343
325source "kernel/gcov/Kconfig" 344source "kernel/gcov/Kconfig"
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 7a08cfb80ee8..5dd7f5db24d4 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -22,6 +22,8 @@ config ALPHA
22 select GENERIC_STRNLEN_USER 22 select GENERIC_STRNLEN_USER
23 select GENERIC_KERNEL_THREAD 23 select GENERIC_KERNEL_THREAD
24 select GENERIC_KERNEL_EXECVE 24 select GENERIC_KERNEL_EXECVE
25 select HAVE_MOD_ARCH_SPECIFIC
26 select MODULES_USE_ELF_RELA
25 help 27 help
26 The Alpha is a 64-bit general-purpose processor designed and 28 The Alpha is a 64-bit general-purpose processor designed and
27 marketed by the Digital Equipment Corporation of blessed memory, 29 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 261fdd085bb9..73067efd4845 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -53,6 +53,8 @@ config ARM
53 select PERF_USE_VMALLOC 53 select PERF_USE_VMALLOC
54 select RTC_LIB 54 select RTC_LIB
55 select SYS_SUPPORTS_APM_EMULATION 55 select SYS_SUPPORTS_APM_EMULATION
56 select HAVE_MOD_ARCH_SPECIFIC if ARM_UNWIND
57 select MODULES_USE_ELF_REL
56 help 58 help
57 The ARM series is a line of low-power-consumption RISC chip designs 59 The ARM series is a line of low-power-consumption RISC chip designs
58 licensed by ARM Ltd and targeted at embedded applications and 60 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 ccd9193932b2..b6f3ad5441c5 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -43,6 +43,8 @@ config BLACKFIN
43 select HAVE_NMI_WATCHDOG if NMI_WATCHDOG 43 select HAVE_NMI_WATCHDOG if NMI_WATCHDOG
44 select GENERIC_SMP_IDLE_THREAD 44 select GENERIC_SMP_IDLE_THREAD
45 select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS 45 select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS
46 select HAVE_MOD_ARCH_SPECIFIC
47 select MODULES_USE_ELF_RELA
46 48
47config GENERIC_CSUM 49config GENERIC_CSUM
48 def_bool y 50 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 45268b50c0c8..aee1b569ee6e 100644
--- a/arch/c6x/Kconfig
+++ b/arch/c6x/Kconfig
@@ -18,6 +18,7 @@ config C6X
18 select OF_EARLY_FLATTREE 18 select OF_EARLY_FLATTREE
19 select GENERIC_CLOCKEVENTS 19 select GENERIC_CLOCKEVENTS
20 select GENERIC_KERNEL_THREAD 20 select GENERIC_KERNEL_THREAD
21 select MODULES_USE_ELF_RELA
21 22
22config MMU 23config MMU
23 def_bool n 24 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 a118163b04ee..a67244473a39 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -48,6 +48,7 @@ config CRIS
48 select GENERIC_IOMAP 48 select GENERIC_IOMAP
49 select GENERIC_SMP_IDLE_THREAD if ETRAX_ARCH_V32 49 select GENERIC_SMP_IDLE_THREAD if ETRAX_ARCH_V32
50 select GENERIC_CMOS_UPDATE 50 select GENERIC_CMOS_UPDATE
51 select MODULES_USE_ELF_RELA
51 52
52config HZ 53config HZ
53 int 54 int
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index ff1bf7fcae8e..6d43a951b5ec 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -10,3 +10,4 @@ header-y += sync_serial.h
10 10
11generic-y += clkdev.h 11generic-y += clkdev.h
12generic-y += exec.h 12generic-y += exec.h
13generic-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 90462eb23d02..98fabd10e95f 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -7,6 +7,7 @@ config H8300
7 select ARCH_WANT_IPC_PARSE_VERSION 7 select ARCH_WANT_IPC_PARSE_VERSION
8 select GENERIC_IRQ_SHOW 8 select GENERIC_IRQ_SHOW
9 select GENERIC_CPU_DEVICES 9 select GENERIC_CPU_DEVICES
10 select MODULES_USE_ELF_RELA
10 11
11config SYMBOL_PREFIX 12config SYMBOL_PREFIX
12 string 13 string
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild
index fccd81eddff1..50bbf387b2f8 100644
--- a/arch/h8300/include/asm/Kbuild
+++ b/arch/h8300/include/asm/Kbuild
@@ -2,3 +2,4 @@ include include/asm-generic/Kbuild.asm
2 2
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += exec.h 4generic-y += exec.h
5generic-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 4c10e607c908..3279646120e3 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -40,6 +40,8 @@ config IA64
40 select ARCH_THREAD_INFO_ALLOCATOR 40 select ARCH_THREAD_INFO_ALLOCATOR
41 select ARCH_CLOCKSOURCE_DATA 41 select ARCH_CLOCKSOURCE_DATA
42 select GENERIC_TIME_VSYSCALL_OLD 42 select GENERIC_TIME_VSYSCALL_OLD
43 select HAVE_MOD_ARCH_SPECIFIC
44 select MODULES_USE_ELF_RELA
43 default y 45 default y
44 help 46 help
45 The Itanium Processor Family is Intel's 64-bit successor to 47 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 e875fc3ce9cb..f807721e19a5 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -14,6 +14,7 @@ config M32R
14 select GENERIC_IRQ_SHOW 14 select GENERIC_IRQ_SHOW
15 select GENERIC_ATOMIC64 15 select GENERIC_ATOMIC64
16 select ARCH_USES_GETTIMEOFFSET 16 select ARCH_USES_GETTIMEOFFSET
17 select MODULES_USE_ELF_RELA
17 18
18config SBUS 19config SBUS
19 bool 20 bool
diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild
index fccd81eddff1..50bbf387b2f8 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -2,3 +2,4 @@ include include/asm-generic/Kbuild.asm
2 2
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += exec.h 4generic-y += exec.h
5generic-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 76fd6e2f71da..e7c161433eae 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -16,6 +16,9 @@ config M68K
16 select ARCH_WANT_IPC_PARSE_VERSION 16 select ARCH_WANT_IPC_PARSE_VERSION
17 select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE 17 select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE
18 select GENERIC_KERNEL_THREAD 18 select GENERIC_KERNEL_THREAD
19 select HAVE_MOD_ARCH_SPECIFIC
20 select MODULES_USE_ELF_REL
21 select MODULES_USE_ELF_RELA
19 22
20config RWSEM_GENERIC_SPINLOCK 23config RWSEM_GENERIC_SPINLOCK
21 bool 24 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 53fd94ab60f0..4cba7439f9de 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -25,6 +25,7 @@ config MICROBLAZE
25 select GENERIC_CPU_DEVICES 25 select GENERIC_CPU_DEVICES
26 select GENERIC_ATOMIC64 26 select GENERIC_ATOMIC64
27 select GENERIC_CLOCKEVENTS 27 select GENERIC_CLOCKEVENTS
28 select MODULES_USE_ELF_RELA
28 29
29config SWAP 30config SWAP
30 def_bool n 31 def_bool n
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 35453eaeffb5..aae16cdfe306 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -37,6 +37,9 @@ config MIPS
37 select BUILDTIME_EXTABLE_SORT 37 select BUILDTIME_EXTABLE_SORT
38 select GENERIC_CLOCKEVENTS 38 select GENERIC_CLOCKEVENTS
39 select GENERIC_CMOS_UPDATE 39 select GENERIC_CMOS_UPDATE
40 select HAVE_MOD_ARCH_SPECIFIC
41 select MODULES_USE_ELF_REL
42 select MODULES_USE_ELF_RELA if 64BIT
40 43
41menu "Machine selection" 44menu "Machine selection"
42 45
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 d6c2a7476bac..414c26920df8 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -31,6 +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_USE_ELF_RELA) += module-rela.o
34 35
35obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o 36obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o
36 37
diff --git a/arch/mips/kernel/module-rela.c b/arch/mips/kernel/module-rela.c
new file mode 100644
index 000000000000..61d60028b888
--- /dev/null
+++ b/arch/mips/kernel/module-rela.c
@@ -0,0 +1,145 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 *
16 * Copyright (C) 2001 Rusty Russell.
17 * Copyright (C) 2003, 2004 Ralf Baechle (ralf@linux-mips.org)
18 * Copyright (C) 2005 Thiemo Seufer
19 */
20
21#include <linux/elf.h>
22#include <linux/err.h>
23#include <linux/errno.h>
24#include <linux/moduleloader.h>
25
26extern int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v);
27
28static int apply_r_mips_32_rela(struct module *me, u32 *location, Elf_Addr v)
29{
30 *location = v;
31
32 return 0;
33}
34
35static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v)
36{
37 if (v % 4) {
38 pr_err("module %s: dangerous R_MIPS_26 RELArelocation\n",
39 me->name);
40 return -ENOEXEC;
41 }
42
43 if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
44 printk(KERN_ERR
45 "module %s: relocation overflow\n",
46 me->name);
47 return -ENOEXEC;
48 }
49
50 *location = (*location & ~0x03ffffff) | ((v >> 2) & 0x03ffffff);
51
52 return 0;
53}
54
55static int apply_r_mips_hi16_rela(struct module *me, u32 *location, Elf_Addr v)
56{
57 *location = (*location & 0xffff0000) |
58 ((((long long) v + 0x8000LL) >> 16) & 0xffff);
59
60 return 0;
61}
62
63static int apply_r_mips_lo16_rela(struct module *me, u32 *location, Elf_Addr v)
64{
65 *location = (*location & 0xffff0000) | (v & 0xffff);
66
67 return 0;
68}
69
70static int apply_r_mips_64_rela(struct module *me, u32 *location, Elf_Addr v)
71{
72 *(Elf_Addr *)location = v;
73
74 return 0;
75}
76
77static int apply_r_mips_higher_rela(struct module *me, u32 *location,
78 Elf_Addr v)
79{
80 *location = (*location & 0xffff0000) |
81 ((((long long) v + 0x80008000LL) >> 32) & 0xffff);
82
83 return 0;
84}
85
86static int apply_r_mips_highest_rela(struct module *me, u32 *location,
87 Elf_Addr v)
88{
89 *location = (*location & 0xffff0000) |
90 ((((long long) v + 0x800080008000LL) >> 48) & 0xffff);
91
92 return 0;
93}
94
95static int (*reloc_handlers_rela[]) (struct module *me, u32 *location,
96 Elf_Addr v) = {
97 [R_MIPS_NONE] = apply_r_mips_none,
98 [R_MIPS_32] = apply_r_mips_32_rela,
99 [R_MIPS_26] = apply_r_mips_26_rela,
100 [R_MIPS_HI16] = apply_r_mips_hi16_rela,
101 [R_MIPS_LO16] = apply_r_mips_lo16_rela,
102 [R_MIPS_64] = apply_r_mips_64_rela,
103 [R_MIPS_HIGHER] = apply_r_mips_higher_rela,
104 [R_MIPS_HIGHEST] = apply_r_mips_highest_rela
105};
106
107int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
108 unsigned int symindex, unsigned int relsec,
109 struct module *me)
110{
111 Elf_Mips_Rela *rel = (void *) sechdrs[relsec].sh_addr;
112 Elf_Sym *sym;
113 u32 *location;
114 unsigned int i;
115 Elf_Addr v;
116 int res;
117
118 pr_debug("Applying relocate section %u to %u\n", relsec,
119 sechdrs[relsec].sh_info);
120
121 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
122 /* This is where to make the change */
123 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
124 + rel[i].r_offset;
125 /* This is the symbol it is referring to */
126 sym = (Elf_Sym *)sechdrs[symindex].sh_addr
127 + ELF_MIPS_R_SYM(rel[i]);
128 if (IS_ERR_VALUE(sym->st_value)) {
129 /* Ignore unresolved weak symbol */
130 if (ELF_ST_BIND(sym->st_info) == STB_WEAK)
131 continue;
132 printk(KERN_WARNING "%s: Unknown symbol %s\n",
133 me->name, strtab + sym->st_name);
134 return -ENOENT;
135 }
136
137 v = sym->st_value + rel[i].r_addend;
138
139 res = reloc_handlers_rela[ELF_MIPS_R_TYPE(rel[i])](me, location, v);
140 if (res)
141 return res;
142 }
143
144 return 0;
145}
diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c
index 4f8c3cba8c0c..07ff5812ffaf 100644
--- a/arch/mips/kernel/module.c
+++ b/arch/mips/kernel/module.c
@@ -51,7 +51,7 @@ void *module_alloc(unsigned long size)
51} 51}
52#endif 52#endif
53 53
54static int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v) 54int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v)
55{ 55{
56 return 0; 56 return 0;
57} 57}
@@ -63,13 +63,6 @@ static int apply_r_mips_32_rel(struct module *me, u32 *location, Elf_Addr v)
63 return 0; 63 return 0;
64} 64}
65 65
66static int apply_r_mips_32_rela(struct module *me, u32 *location, Elf_Addr v)
67{
68 *location = v;
69
70 return 0;
71}
72
73static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) 66static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v)
74{ 67{
75 if (v % 4) { 68 if (v % 4) {
@@ -91,26 +84,6 @@ static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v)
91 return 0; 84 return 0;
92} 85}
93 86
94static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v)
95{
96 if (v % 4) {
97 pr_err("module %s: dangerous R_MIPS_26 RELArelocation\n",
98 me->name);
99 return -ENOEXEC;
100 }
101
102 if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
103 printk(KERN_ERR
104 "module %s: relocation overflow\n",
105 me->name);
106 return -ENOEXEC;
107 }
108
109 *location = (*location & ~0x03ffffff) | ((v >> 2) & 0x03ffffff);
110
111 return 0;
112}
113
114static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v) 87static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v)
115{ 88{
116 struct mips_hi16 *n; 89 struct mips_hi16 *n;
@@ -132,14 +105,6 @@ static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v)
132 return 0; 105 return 0;
133} 106}
134 107
135static int apply_r_mips_hi16_rela(struct module *me, u32 *location, Elf_Addr v)
136{
137 *location = (*location & 0xffff0000) |
138 ((((long long) v + 0x8000LL) >> 16) & 0xffff);
139
140 return 0;
141}
142
143static void free_relocation_chain(struct mips_hi16 *l) 108static void free_relocation_chain(struct mips_hi16 *l)
144{ 109{
145 struct mips_hi16 *next; 110 struct mips_hi16 *next;
@@ -217,38 +182,6 @@ out_danger:
217 return -ENOEXEC; 182 return -ENOEXEC;
218} 183}
219 184
220static int apply_r_mips_lo16_rela(struct module *me, u32 *location, Elf_Addr v)
221{
222 *location = (*location & 0xffff0000) | (v & 0xffff);
223
224 return 0;
225}
226
227static int apply_r_mips_64_rela(struct module *me, u32 *location, Elf_Addr v)
228{
229 *(Elf_Addr *)location = v;
230
231 return 0;
232}
233
234static int apply_r_mips_higher_rela(struct module *me, u32 *location,
235 Elf_Addr v)
236{
237 *location = (*location & 0xffff0000) |
238 ((((long long) v + 0x80008000LL) >> 32) & 0xffff);
239
240 return 0;
241}
242
243static int apply_r_mips_highest_rela(struct module *me, u32 *location,
244 Elf_Addr v)
245{
246 *location = (*location & 0xffff0000) |
247 ((((long long) v + 0x800080008000LL) >> 48) & 0xffff);
248
249 return 0;
250}
251
252static int (*reloc_handlers_rel[]) (struct module *me, u32 *location, 185static int (*reloc_handlers_rel[]) (struct module *me, u32 *location,
253 Elf_Addr v) = { 186 Elf_Addr v) = {
254 [R_MIPS_NONE] = apply_r_mips_none, 187 [R_MIPS_NONE] = apply_r_mips_none,
@@ -258,18 +191,6 @@ static int (*reloc_handlers_rel[]) (struct module *me, u32 *location,
258 [R_MIPS_LO16] = apply_r_mips_lo16_rel 191 [R_MIPS_LO16] = apply_r_mips_lo16_rel
259}; 192};
260 193
261static int (*reloc_handlers_rela[]) (struct module *me, u32 *location,
262 Elf_Addr v) = {
263 [R_MIPS_NONE] = apply_r_mips_none,
264 [R_MIPS_32] = apply_r_mips_32_rela,
265 [R_MIPS_26] = apply_r_mips_26_rela,
266 [R_MIPS_HI16] = apply_r_mips_hi16_rela,
267 [R_MIPS_LO16] = apply_r_mips_lo16_rela,
268 [R_MIPS_64] = apply_r_mips_64_rela,
269 [R_MIPS_HIGHER] = apply_r_mips_higher_rela,
270 [R_MIPS_HIGHEST] = apply_r_mips_highest_rela
271};
272
273int apply_relocate(Elf_Shdr *sechdrs, const char *strtab, 194int apply_relocate(Elf_Shdr *sechdrs, const char *strtab,
274 unsigned int symindex, unsigned int relsec, 195 unsigned int symindex, unsigned int relsec,
275 struct module *me) 196 struct module *me)
@@ -324,46 +245,6 @@ int apply_relocate(Elf_Shdr *sechdrs, const char *strtab,
324 return 0; 245 return 0;
325} 246}
326 247
327int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
328 unsigned int symindex, unsigned int relsec,
329 struct module *me)
330{
331 Elf_Mips_Rela *rel = (void *) sechdrs[relsec].sh_addr;
332 Elf_Sym *sym;
333 u32 *location;
334 unsigned int i;
335 Elf_Addr v;
336 int res;
337
338 pr_debug("Applying relocate section %u to %u\n", relsec,
339 sechdrs[relsec].sh_info);
340
341 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
342 /* This is where to make the change */
343 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
344 + rel[i].r_offset;
345 /* This is the symbol it is referring to */
346 sym = (Elf_Sym *)sechdrs[symindex].sh_addr
347 + ELF_MIPS_R_SYM(rel[i]);
348 if (IS_ERR_VALUE(sym->st_value)) {
349 /* Ignore unresolved weak symbol */
350 if (ELF_ST_BIND(sym->st_info) == STB_WEAK)
351 continue;
352 printk(KERN_WARNING "%s: Unknown symbol %s\n",
353 me->name, strtab + sym->st_name);
354 return -ENOENT;
355 }
356
357 v = sym->st_value + rel[i].r_addend;
358
359 res = reloc_handlers_rela[ELF_MIPS_R_TYPE(rel[i])](me, location, v);
360 if (res)
361 return res;
362 }
363
364 return 0;
365}
366
367/* Given an address, look for it in the module exception tables. */ 248/* Given an address, look for it in the module exception tables. */
368const struct exception_table_entry *search_module_dbetables(unsigned long addr) 249const struct exception_table_entry *search_module_dbetables(unsigned long addr)
369{ 250{
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index ddbdc33471a8..04669fac117b 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -9,6 +9,7 @@ config MN10300
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 GENERIC_KERNEL_THREAD 11 select GENERIC_KERNEL_THREAD
12 select MODULES_USE_ELF_RELA
12 13
13config AM33_2 14config AM33_2
14 def_bool n 15 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 b87438bb3384..11def45b98c5 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -20,6 +20,8 @@ config PARISC
20 select ARCH_HAVE_NMI_SAFE_CMPXCHG 20 select ARCH_HAVE_NMI_SAFE_CMPXCHG
21 select GENERIC_SMP_IDLE_THREAD 21 select GENERIC_SMP_IDLE_THREAD
22 select GENERIC_STRNCPY_FROM_USER 22 select GENERIC_STRNCPY_FROM_USER
23 select HAVE_MOD_ARCH_SPECIFIC
24 select MODULES_USE_ELF_RELA
23 25
24 help 26 help
25 The PA-RISC microprocessor is designed by Hewlett-Packard and used 27 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 969f3d9ded91..a902a5c1c76a 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -142,6 +142,8 @@ config PPC
142 select GENERIC_STRNCPY_FROM_USER 142 select GENERIC_STRNCPY_FROM_USER
143 select GENERIC_STRNLEN_USER 143 select GENERIC_STRNLEN_USER
144 select GENERIC_KERNEL_THREAD 144 select GENERIC_KERNEL_THREAD
145 select HAVE_MOD_ARCH_SPECIFIC
146 select MODULES_USE_ELF_RELA
145 147
146config EARLY_PRINTK 148config EARLY_PRINTK
147 bool 149 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 e5dac1236185..3f3d9ca7a5b6 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -136,6 +136,8 @@ config S390
136 select KTIME_SCALAR if 32BIT 136 select KTIME_SCALAR if 32BIT
137 select HAVE_ARCH_SECCOMP_FILTER 137 select HAVE_ARCH_SECCOMP_FILTER
138 select GENERIC_KERNEL_THREAD 138 select GENERIC_KERNEL_THREAD
139 select HAVE_MOD_ARCH_SPECIFIC
140 select MODULES_USE_ELF_RELA
139 141
140config SCHED_OMIT_FRAME_POINTER 142config SCHED_OMIT_FRAME_POINTER
141 def_bool y 143 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 461c23747491..4f93a431a45a 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -11,6 +11,8 @@ config SCORE
11 select ARCH_DISCARD_MEMBLOCK 11 select ARCH_DISCARD_MEMBLOCK
12 select GENERIC_CPU_DEVICES 12 select GENERIC_CPU_DEVICES
13 select GENERIC_CLOCKEVENTS 13 select GENERIC_CLOCKEVENTS
14 select HAVE_MOD_ARCH_SPECIFIC
15 select MODULES_USE_ELF_REL
14 16
15choice 17choice
16 prompt "System type" 18 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 3b3e27a3ff2c..babc2b826c5c 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -38,6 +38,8 @@ config SUPERH
38 select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST 38 select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
39 select GENERIC_STRNCPY_FROM_USER 39 select GENERIC_STRNCPY_FROM_USER
40 select GENERIC_STRNLEN_USER 40 select GENERIC_STRNLEN_USER
41 select HAVE_MOD_ARCH_SPECIFIC if DWARF_UNWINDER
42 select MODULES_USE_ELF_RELA
41 help 43 help
42 The SuperH is a RISC processor targeted for use in embedded systems 44 The SuperH is a RISC processor targeted for use in embedded systems
43 and consumer electronics; it was also used in the Sega Dreamcast 45 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 91c780c973ba..b6b442b0d793 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -39,6 +39,7 @@ config SPARC
39 select GENERIC_CLOCKEVENTS 39 select GENERIC_CLOCKEVENTS
40 select GENERIC_STRNCPY_FROM_USER 40 select GENERIC_STRNCPY_FROM_USER
41 select GENERIC_STRNLEN_USER 41 select GENERIC_STRNLEN_USER
42 select MODULES_USE_ELF_RELA
42 43
43config SPARC32 44config SPARC32
44 def_bool !64BIT 45 def_bool !64BIT
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 10d54e5e37f5..645a58da0e86 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -7,4 +7,5 @@ generic-y += exec.h
7generic-y += local64.h 7generic-y += local64.h
8generic-y += irq_regs.h 8generic-y += irq_regs.h
9generic-y += local.h 9generic-y += local.h
10generic-y += module.h
10generic-y += word-at-a-time.h 11generic-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 dc46490adca0..875d008828b8 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -20,6 +20,7 @@ config TILE
20 select SYS_HYPERVISOR 20 select SYS_HYPERVISOR
21 select ARCH_HAVE_NMI_SAFE_CMPXCHG 21 select ARCH_HAVE_NMI_SAFE_CMPXCHG
22 select GENERIC_CLOCKEVENTS 22 select GENERIC_CLOCKEVENTS
23 select MODULES_USE_ELF_RELA
23 24
24# FIXME: investigate whether we need/want these options. 25# FIXME: investigate whether we need/want these options.
25# select HAVE_IOREMAP_PROT 26# select HAVE_IOREMAP_PROT
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
index 35ee2bf66354..e5c5473e69ce 100644
--- a/arch/unicore32/Kconfig
+++ b/arch/unicore32/Kconfig
@@ -15,6 +15,7 @@ config UNICORE32
15 select GENERIC_IRQ_SHOW 15 select GENERIC_IRQ_SHOW
16 select ARCH_WANT_FRAME_POINTERS 16 select ARCH_WANT_FRAME_POINTERS
17 select GENERIC_IOMAP 17 select GENERIC_IOMAP
18 select MODULES_USE_ELF_REL
18 help 19 help
19 UniCore-32 is 32-bit Instruction Set Architecture, 20 UniCore-32 is 32-bit Instruction Set Architecture,
20 including a series of low-power-consumption RISC chip 21 including a series of low-power-consumption RISC chip
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 70071b19eb98..46c3bff3ced2 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -110,6 +110,8 @@ config X86
110 select HAVE_IRQ_TIME_ACCOUNTING 110 select HAVE_IRQ_TIME_ACCOUNTING
111 select GENERIC_KERNEL_THREAD 111 select GENERIC_KERNEL_THREAD
112 select GENERIC_KERNEL_EXECVE 112 select GENERIC_KERNEL_EXECVE
113 select MODULES_USE_ELF_REL if X86_32
114 select MODULES_USE_ELF_RELA if X86_64
113 115
114config INSTRUCTION_DECODER 116config INSTRUCTION_DECODER
115 def_bool y 117 def_bool y
diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig
index 9fa950df80e5..07611759ce35 100644
--- a/arch/x86/um/Kconfig
+++ b/arch/x86/um/Kconfig
@@ -24,9 +24,11 @@ config X86_32
24 def_bool !64BIT 24 def_bool !64BIT
25 select HAVE_AOUT 25 select HAVE_AOUT
26 select ARCH_WANT_IPC_PARSE_VERSION 26 select ARCH_WANT_IPC_PARSE_VERSION
27 select MODULES_USE_ELF_REL
27 28
28config X86_64 29config X86_64
29 def_bool 64BIT 30 def_bool 64BIT
31 select MODULES_USE_ELF_RELA
30 32
31config RWSEM_XCHGADD_ALGORITHM 33config RWSEM_XCHGADD_ALGORITHM
32 def_bool X86_XADD && 64BIT 34 def_bool X86_XADD && 64BIT
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 */