1 --- a/scripts/kallsyms.c
2 +++ b/scripts/kallsyms.c
3 @@ -58,6 +58,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 unsigned long long kernel_start_addr = 0;
11 @@ -392,6 +393,9 @@ static void write_src(void)
18 output_label("kallsyms_token_table");
20 for (i = 0; i < 256; i++) {
21 @@ -450,6 +454,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 @@ -522,6 +529,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 @@ -692,7 +702,9 @@ int main(int argc, char **argv)
42 } else if (strncmp(argv[i], "--page-offset=", 14) == 0) {
43 const char *p = &argv[i][14];
44 kernel_start_addr = strtoull(p, NULL, 16);
46 + } else if (strcmp(argv[i], "--uncompressed") == 0)
54 @@ -1338,6 +1338,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW
55 the unaligned access emulation.
56 see arch/parisc/kernel/unaligned.c for reference
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.
69 config HAVE_PCSPKR_PLATFORM
72 --- a/scripts/link-vmlinux.sh
73 +++ b/scripts/link-vmlinux.sh
74 @@ -90,6 +90,10 @@ kallsyms()
75 kallsymopt="${kallsymopt} --absolute-percpu"
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 @@ -109,6 +109,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 @@ -141,6 +146,9 @@ tail:
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.