kernel: fix compile error on linux 4.9 with CONFIG_KALLSYMS disabled
[openwrt/openwrt.git] / target / linux / generic / patches-4.9 / 205-backtrace_module_info.patch
1 --- a/lib/vsprintf.c
2 +++ b/lib/vsprintf.c
3 @@ -669,8 +669,10 @@ char *symbol_string(char *buf, char *end
4 struct printf_spec spec, const char *fmt)
5 {
6 unsigned long value;
7 -#ifdef CONFIG_KALLSYMS
8 char sym[KSYM_SYMBOL_LEN];
9 +#ifndef CONFIG_KALLSYMS
10 + struct module *mod;
11 + int len;
12 #endif
13
14 if (fmt[1] == 'R')
15 @@ -684,11 +686,16 @@ char *symbol_string(char *buf, char *end
16 sprint_symbol(sym, value);
17 else
18 sprint_symbol_no_offset(sym, value);
19 -
20 - return string(buf, end, sym, spec);
21 #else
22 - return special_hex_number(buf, end, value, sizeof(void *));
23 + len = snprintf(sym, sizeof(sym), "0x%lx", value);
24 +
25 + mod = __module_address(value);
26 + if (mod)
27 + snprintf(sym + len, sizeof(sym) - len, " [%s@%p+0x%x]",
28 + mod->name, mod->core_layout.base,
29 + mod->core_layout.size);
30 #endif
31 + return string(buf, end, sym, spec);
32 }
33
34 static noinline_for_stack