kernel/3.1[02]: move MTD root device setup code to mtdcore
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-3.10 / 203-kallsyms_uncompressed.patch
1 --- a/scripts/kallsyms.c
2 +++ b/scripts/kallsyms.c
3 @@ -54,6 +54,7 @@ static struct text_range text_ranges[] =
4 static struct sym_entry *table;
5 static unsigned int table_size, table_cnt;
6 static int all_symbols = 0;
7 +static int uncompressed = 0;
8 static char symbol_prefix_char = '\0';
9
10 int token_profit[0x10000];
11 @@ -360,6 +361,9 @@ static void write_src(void)
12
13 free(markers);
14
15 + if (uncompressed)
16 + return;
17 +
18 output_label("kallsyms_token_table");
19 off = 0;
20 for (i = 0; i < 256; i++) {
21 @@ -418,6 +422,9 @@ static void *find_token(unsigned char *s
22 {
23 int i;
24
25 + if (uncompressed)
26 + return NULL;
27 +
28 for (i = 0; i < len - 1; i++) {
29 if (str[i] == token[0] && str[i+1] == token[1])
30 return &str[i];
31 @@ -490,6 +497,9 @@ static void optimize_result(void)
32 {
33 int i, best;
34
35 + if (uncompressed)
36 + return;
37 +
38 /* using the '\0' symbol last allows compress_symbols to use standard
39 * fast string functions */
40 for (i = 255; i >= 0; i--) {
41 @@ -646,7 +656,9 @@ int main(int argc, char **argv)
42 if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\''))
43 p++;
44 symbol_prefix_char = *p;
45 - } else
46 + } else if (strcmp(argv[i], "--uncompressed") == 0)
47 + uncompressed = 1;
48 + else
49 usage();
50 }
51 } else if (argc != 1)
52 --- a/init/Kconfig
53 +++ b/init/Kconfig
54 @@ -1245,6 +1245,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW
55 the unaligned access emulation.
56 see arch/parisc/kernel/unaligned.c for reference
57
58 +config KALLSYMS_UNCOMPRESSED
59 + bool "Keep kallsyms uncompressed"
60 + depends on KALLSYMS
61 + help
62 + Normally kallsyms contains compressed symbols (using a token table),
63 + reducing the uncompressed kernel image size. Keeping the symbol table
64 + uncompressed significantly improves the size of this part in compressed
65 + kernel images.
66 +
67 + Say N unless you need compressed kernel images to be small.
68 +
69 config HOTPLUG
70 def_bool y
71
72 --- a/scripts/link-vmlinux.sh
73 +++ b/scripts/link-vmlinux.sh
74 @@ -82,6 +82,10 @@ kallsyms()
75 kallsymopt="${kallsymopt} --all-symbols"
76 fi
77
78 + if [ -n "${CONFIG_KALLSYMS_UNCOMPRESSED}" ]; then
79 + kallsymopt="${kallsymopt} --uncompressed"
80 + fi
81 +
82 local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \
83 ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}"
84
85 --- a/kernel/kallsyms.c
86 +++ b/kernel/kallsyms.c
87 @@ -108,6 +108,11 @@ static unsigned int kallsyms_expand_symb
88 * For every byte on the compressed symbol data, copy the table
89 * entry for that byte.
90 */
91 +#ifdef CONFIG_KALLSYMS_UNCOMPRESSED
92 + memcpy(result, data + 1, len - 1);
93 + result += len - 1;
94 + len = 0;
95 +#endif
96 while (len) {
97 tptr = &kallsyms_token_table[kallsyms_token_index[*data]];
98 data++;
99 @@ -140,6 +145,9 @@ tail:
100 */
101 static char kallsyms_get_symbol_type(unsigned int off)
102 {
103 +#ifdef CONFIG_KALLSYMS_UNCOMPRESSED
104 + return kallsyms_names[off + 1];
105 +#endif
106 /*
107 * Get just the first code, look it up in the token table,
108 * and return the first char from this token.