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';
10 int token_profit[0x10000];
11 @@ -360,6 +361,9 @@ static void write_src(void)
18 output_label("kallsyms_token_table");
20 for (i = 0; i < 256; i++) {
21 @@ -418,6 +422,9 @@ static void *find_token(unsigned char *s
28 for (i = 0; i < len - 1; i++) {
29 if (str[i] == token[0] && str[i+1] == token[1])
31 @@ -490,6 +497,9 @@ static void optimize_result(void)
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) == '\''))
44 symbol_prefix_char = *p;
46 + } else if (strcmp(argv[i], "--uncompressed") == 0)
54 @@ -1259,6 +1259,17 @@ config KALLSYMS_ALL
56 Say N unless you really need all symbols.
58 +config KALLSYMS_UNCOMPRESSED
59 + bool "Keep kallsyms uncompressed"
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
67 + Say N unless you need compressed kernel images to be small.
72 --- a/scripts/link-vmlinux.sh
73 +++ b/scripts/link-vmlinux.sh
74 @@ -83,6 +83,10 @@ kallsyms()
75 kallsymopt="${kallsymopt} --all-symbols"
78 + if [ -n "${CONFIG_KALLSYMS_UNCOMPRESSED}" ]; then
79 + kallsymopt="${kallsymopt} --uncompressed"
82 local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \
83 ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}"
85 --- a/kernel/kallsyms.c
86 +++ b/kernel/kallsyms.c
87 @@ -106,6 +106,11 @@ static unsigned int kallsyms_expand_symb
88 * For every byte on the compressed symbol data, copy the table
89 * entry for that byte.
91 +#ifdef CONFIG_KALLSYMS_UNCOMPRESSED
92 + memcpy(result, data + 1, len - 1);
97 tptr = &kallsyms_token_table[kallsyms_token_index[*data]];
99 @@ -133,6 +138,9 @@ static unsigned int kallsyms_expand_symb
101 static char kallsyms_get_symbol_type(unsigned int off)
103 +#ifdef CONFIG_KALLSYMS_UNCOMPRESSED
104 + return kallsyms_names[off + 1];
107 * Get just the first code, look it up in the token table,
108 * and return the first char from this token.