aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2012-09-28 01:01:03 -0400
committerRusty Russell <rusty@rustcorp.com.au>2012-09-28 01:01:03 -0400
commit786d35d45cc40b2a51a18f73e14e135d47fdced7 (patch)
treedf18f4dc3f8a333267e74089760043769b3b6184 /arch/mips
parent6ede81239e31cfacbb1e2d260530cd80d13cf0db (diff)
Make most arch asm/module.h files use asm-generic/module.h
Use the mapping of Elf_[SPE]hdr, Elf_Addr, Elf_Sym, Elf_Dyn, Elf_Rel/Rela, ELF_R_TYPE() and ELF_R_SYM() to either the 32-bit version or the 64-bit version into asm-generic/module.h for all arches bar MIPS. Also, use the generic definition mod_arch_specific where possible. To this end, I've defined three new config bools: (*) HAVE_MOD_ARCH_SPECIFIC Arches define this if they don't want to use the empty generic mod_arch_specific struct. (*) MODULES_USE_ELF_RELA Arches define this if their modules can contain RELA records. This causes the Elf_Rela mapping to be emitted and allows apply_relocate_add() to be defined by the arch rather than have the core emit an error message. (*) MODULES_USE_ELF_REL Arches define this if their modules can contain REL records. This causes the Elf_Rel mapping to be emitted and allows apply_relocate() to be defined by the arch rather than have the core emit an error message. Note that it is possible to allow both REL and RELA records: m68k and mips are two arches that do this. With this, some arch asm/module.h files can be deleted entirely and replaced with a generic-y marker in the arch Kbuild file. Additionally, I have removed the bits from m32r and score that handle the unsupported type of relocation record as that's now handled centrally. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/Kconfig3
-rw-r--r--arch/mips/include/asm/module.h10
-rw-r--r--arch/mips/kernel/Makefile2
3 files changed, 12 insertions, 3 deletions
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