summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2013-08-04 13:54:42 +0000
committerJohn Crispin <john@openwrt.org>2013-08-04 13:54:42 +0000
commitdb083a41cf533818ac9a3d0f0715981f9d47508f (patch)
tree52e041071ad877ed2bf7e9ce87aee8d1d7071281
parent3a2040ffee99053070cd3f0424f40f64ba6403c9 (diff)
downloadmtk-20170518-db083a41cf533818ac9a3d0f0715981f9d47508f.zip
mtk-20170518-db083a41cf533818ac9a3d0f0715981f9d47508f.tar.gz
mtk-20170518-db083a41cf533818ac9a3d0f0715981f9d47508f.tar.bz2
generic: make the module reloc pacth work on mips64
Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 37685
-rw-r--r--target/linux/generic/patches-3.10/305-mips_module_reloc.patch43
1 files changed, 26 insertions, 17 deletions
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 5d2f1e2..ceae7fd 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);
}