20c6132e4f93a9779c795d994d90fe54ae64907b
[openwrt/staging/blogic.git] /
1 From 819b4bda18d62b52d04789c4a8d4fc3fbf9ce242 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Mon, 13 Jul 2009 10:46:49 +0200
4 Subject: [PATCH] MIPS: fix loading of modules with unresolved weak symbols
5
6 Loading of modules with unresolved weak symbols fails on MIPS
7 since '88173507e4fc1e7ecd111b0565e8cba0cb7dae6d'.
8
9 Modules: handle symbols that have a zero value
10
11 The module subsystem cannot handle symbols that are zero. If symbols
12 are present that have a zero value then the module resolver prints out a
13 message that these symbols are unresolved.
14
15 We have to use IS_ERR_VALUE() to check that a symbol has been resolved
16 or not.
17
18 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
19 ---
20 arch/mips/kernel/module.c | 4 ++--
21 1 files changed, 2 insertions(+), 2 deletions(-)
22
23 --- a/arch/mips/kernel/module.c
24 +++ b/arch/mips/kernel/module.c
25 @@ -303,7 +303,7 @@ int apply_relocate(Elf_Shdr *sechdrs, co
26 /* This is the symbol it is referring to */
27 sym = (Elf_Sym *)sechdrs[symindex].sh_addr
28 + ELF_MIPS_R_SYM(rel[i]);
29 - if (!sym->st_value) {
30 + if (IS_ERR_VALUE(sym->st_value)) {
31 /* Ignore unresolved weak symbol */
32 if (ELF_ST_BIND(sym->st_info) == STB_WEAK)
33 continue;
34 @@ -343,7 +343,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs
35 /* This is the symbol it is referring to */
36 sym = (Elf_Sym *)sechdrs[symindex].sh_addr
37 + ELF_MIPS_R_SYM(rel[i]);
38 - if (!sym->st_value) {
39 + if (IS_ERR_VALUE(sym->st_value)) {
40 /* Ignore unresolved weak symbol */
41 if (ELF_ST_BIND(sym->st_info) == STB_WEAK)
42 continue;