1 --- a/scripts/kallsyms.c
2 +++ b/scripts/kallsyms.c
3 @@ -61,6 +61,7 @@ static struct addr_range percpu_range =
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 int absolute_percpu = 0;
9 static char symbol_prefix_char = '\0';
10 static int base_relative = 0;
11 @@ -446,6 +447,9 @@ static void write_src(void)
18 output_label("kallsyms_token_table");
20 for (i = 0; i < 256; i++) {
21 @@ -504,6 +508,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 @@ -576,6 +583,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 @@ -764,6 +774,8 @@ int main(int argc, char **argv)
42 symbol_prefix_char = *p;
43 } else if (strcmp(argv[i], "--base-relative") == 0)
45 + else if (strcmp(argv[i], "--uncompressed") == 0)
52 @@ -1370,6 +1370,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW
53 the unaligned access emulation.
54 see arch/parisc/kernel/unaligned.c for reference
56 +config KALLSYMS_UNCOMPRESSED
57 + bool "Keep kallsyms uncompressed"
60 + Normally kallsyms contains compressed symbols (using a token table),
61 + reducing the uncompressed kernel image size. Keeping the symbol table
62 + uncompressed significantly improves the size of this part in compressed
65 + Say N unless you need compressed kernel images to be small.
67 config HAVE_PCSPKR_PLATFORM
70 --- a/scripts/link-vmlinux.sh
71 +++ b/scripts/link-vmlinux.sh
72 @@ -136,6 +136,10 @@ kallsyms()
73 kallsymopt="${kallsymopt} --base-relative"
76 + if [ -n "${CONFIG_KALLSYMS_UNCOMPRESSED}" ]; then
77 + kallsymopt="${kallsymopt} --uncompressed"
80 local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \
81 ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}"
83 --- a/kernel/kallsyms.c
84 +++ b/kernel/kallsyms.c
85 @@ -113,6 +113,11 @@ static unsigned int kallsyms_expand_symb
86 * For every byte on the compressed symbol data, copy the table
87 * entry for that byte.
89 +#ifdef CONFIG_KALLSYMS_UNCOMPRESSED
90 + memcpy(result, data + 1, len - 1);
95 tptr = &kallsyms_token_table[kallsyms_token_index[*data]];
97 @@ -145,6 +150,9 @@ tail:
99 static char kallsyms_get_symbol_type(unsigned int off)
101 +#ifdef CONFIG_KALLSYMS_UNCOMPRESSED
102 + return kallsyms_names[off + 1];
105 * Get just the first code, look it up in the token table,
106 * and return the first char from this token.