aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/patches-3.6/310-arm_module_unresolved_weak_sym.patch
blob: d1eba550388547283831eba5dd618c3c47b61d98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -81,6 +81,10 @@ apply_relocate(Elf32_Shdr *sechdrs, cons
 			return -ENOEXEC;
 		}
 
+		if ((IS_ERR_VALUE(sym->st_value) || !sym->st_value) &&
+		    ELF_ST_BIND(sym->st_info) == STB_WEAK)
+			continue;
+
 		loc = dstsec->sh_addr + rel->r_offset;
 
 		switch (ELF32_R_TYPE(rel->r_info)) {
ght .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
--- a/arch/mips/ath79/prom.c
+++ b/arch/mips/ath79/prom.c
@@ -33,6 +33,41 @@ static void __init ath79_prom_append_cmd
 	strlcat(arcs_cmdline, ath79_cmdline_buf, sizeof(arcs_cmdline));
 }
 
+#ifdef CONFIG_IMAGE_CMDLINE_HACK
+extern char __image_cmdline[];
+
+static int __init ath79_use_image_cmdline(void)
+{
+	char *p = __image_cmdline;
+	int replace = 0;
+
+	if (*p == '-') {
+		replace = 1;
+		p++;
+	}
+
+	if (*p == '\0')
+		return 0;
+
+	if (replace) {
+		strlcpy(arcs_cmdline, p, sizeof(arcs_cmdline));
+	} else {
+		strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline));
+		strlcat(arcs_cmdline, p, sizeof(arcs_cmdline));
+	}
+
+	/* Validate and setup environment pointer */
+	if (fw_arg2 < CKSEG0)
+		_fw_envp = NULL;
+	else
+		_fw_envp = (int *)fw_arg2;
+
+	return 1;
+}
+#else
+static inline int ath79_use_image_cmdline(void) { return 0; }
+#endif
+
 static int __init ath79_prom_init_myloader(void)
 {
 	struct myloader_info *mylo;
@@ -61,6 +96,8 @@ static int __init ath79_prom_init_myload
 
 	ath79_prom_append_cmdline("ethaddr", mac_buf);
 
+	ath79_use_image_cmdline();
+
 	return 1;
 }
 
@@ -71,7 +108,8 @@ void __init prom_init(void)
 	if (ath79_prom_init_myloader())
 		return;
 
-	fw_init_cmdline();
+	if (!ath79_use_image_cmdline())
+		fw_init_cmdline();
 
 	env = fw_getenv("ethaddr");
 	if (env)
--- a/arch/mips/fw/lib/cmdline.c
+++ b/arch/mips/fw/lib/cmdline.c
@@ -35,6 +35,7 @@ void __init fw_init_cmdline(void)
 	else
 		_fw_envp = (int *)fw_arg2;
 
+	arcs_cmdline[0] = '\0';
 	for (i = 1; i < fw_argc; i++) {
 		strlcat(arcs_cmdline, fw_argv(i), COMMAND_LINE_SIZE);
 		if (i < (fw_argc - 1))