From: John Crispin Date: Sun, 4 Aug 2013 13:54:42 +0000 (+0000) Subject: generic: make the module reloc pacth work on mips64 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=db083a41cf533818ac9a3d0f0715981f9d47508f;p=openwrt%2Fstaging%2Fluka.git generic: make the module reloc pacth work on mips64 Signed-off-by: John Crispin SVN-Revision: 37685 --- diff --git a/target/linux/generic/patches-3.10/305-mips_module_reloc.patch b/target/linux/generic/patches-3.10/305-mips_module_reloc.patch index 5d2f1e2521..ceae7fd039 100644 --- a/target/linux/generic/patches-3.10/305-mips_module_reloc.patch +++ b/target/linux/generic/patches-3.10/305-mips_module_reloc.patch @@ -1,6 +1,8 @@ ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -90,8 +90,13 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin +Index: linux-3.10/arch/mips/Makefile +=================================================================== +--- linux-3.10.orig/arch/mips/Makefile 2013-08-04 14:03:15.323485386 +0200 ++++ linux-3.10/arch/mips/Makefile 2013-08-04 14:03:15.379485387 +0200 +@@ -90,8 +90,13 @@ cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely cflags-y += -msoft-float LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections @@ -14,9 +16,11 @@ ifndef CONFIG_FUNCTION_TRACER KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections ---- a/arch/mips/include/asm/module.h -+++ b/arch/mips/include/asm/module.h -@@ -11,6 +11,11 @@ struct mod_arch_specific { +Index: linux-3.10/arch/mips/include/asm/module.h +=================================================================== +--- linux-3.10.orig/arch/mips/include/asm/module.h 2013-07-01 00:13:29.000000000 +0200 ++++ linux-3.10/arch/mips/include/asm/module.h 2013-08-04 14:03:15.383485387 +0200 +@@ -11,6 +11,11 @@ const struct exception_table_entry *dbe_start; const struct exception_table_entry *dbe_end; struct mips_hi16 *r_mips_hi16_list; @@ -28,9 +32,11 @@ }; typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */ ---- a/arch/mips/kernel/module.c -+++ b/arch/mips/kernel/module.c -@@ -42,14 +42,219 @@ struct mips_hi16 { +Index: linux-3.10/arch/mips/kernel/module.c +=================================================================== +--- linux-3.10.orig/arch/mips/kernel/module.c 2013-07-01 00:13:29.000000000 +0200 ++++ linux-3.10/arch/mips/kernel/module.c 2013-08-04 15:31:24.995611431 +0200 +@@ -42,14 +42,222 @@ static LIST_HEAD(dbe_list); static DEFINE_SPINLOCK(dbe_lock); @@ -220,6 +226,14 @@ + unsigned int core_size, init_size; + int i; + ++ mod->arch.phys_plt_offset = 0; ++ mod->arch.virt_plt_offset = 0; ++ mod->arch.phys_plt_tbl = NULL; ++ mod->arch.virt_plt_tbl = NULL; ++ ++ if (IS_ENABLED(CONFIG_64BIT)) ++ return 0; ++ + for (i = 1; i < hdr->e_shnum; i++) + if (sechdrs[i].sh_type == SHT_SYMTAB) + symindex = i; @@ -227,11 +241,6 @@ + core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false); + init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true); + -+ mod->arch.phys_plt_offset = 0; -+ mod->arch.virt_plt_offset = 0; -+ mod->arch.phys_plt_tbl = NULL; -+ mod->arch.virt_plt_tbl = NULL; -+ + if ((core_size + init_size) == 0) + return 0; + @@ -251,7 +260,7 @@ int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v) { -@@ -63,8 +268,39 @@ static int apply_r_mips_32_rel(struct mo +@@ -63,8 +271,39 @@ return 0; } @@ -291,7 +300,7 @@ if (v % 4) { pr_err("module %s: dangerous R_MIPS_26 REL relocation\n", me->name); -@@ -72,14 +308,17 @@ static int apply_r_mips_26_rel(struct mo +@@ -72,14 +311,17 @@ } if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { @@ -314,7 +323,7 @@ return 0; } -@@ -286,11 +525,32 @@ int module_finalize(const Elf_Ehdr *hdr, +@@ -286,11 +528,32 @@ list_add(&me->arch.dbe_list, &dbe_list); spin_unlock_irq(&dbe_lock); }