imx6: disable MSI interrupts
[oweals/openwrt.git] / target / linux / generic / patches-4.9 / 203-kallsyms_uncompressed.patch
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)
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 @@ -504,6 +508,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 @@ -576,6 +583,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 @@ -764,6 +774,8 @@ int main(int argc, char **argv)
42                                 symbol_prefix_char = *p;
43                         } else if (strcmp(argv[i], "--base-relative") == 0)
44                                 base_relative = 1;
45 +                       else if (strcmp(argv[i], "--uncompressed") == 0)
46 +                               uncompressed = 1;
47                         else
48                                 usage();
49                 }
50 --- a/init/Kconfig
51 +++ b/init/Kconfig
52 @@ -1370,6 +1370,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW
53           the unaligned access emulation.
54           see arch/parisc/kernel/unaligned.c for reference
55  
56 +config KALLSYMS_UNCOMPRESSED
57 +       bool "Keep kallsyms uncompressed"
58 +       depends on KALLSYMS
59 +       help
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
63 +               kernel images.
64 +
65 +               Say N unless you need compressed kernel images to be small.
66 +
67  config HAVE_PCSPKR_PLATFORM
68         bool
69  
70 --- a/scripts/link-vmlinux.sh
71 +++ b/scripts/link-vmlinux.sh
72 @@ -136,6 +136,10 @@ kallsyms()
73                 kallsymopt="${kallsymopt} --base-relative"
74         fi
75  
76 +       if [ -n "${CONFIG_KALLSYMS_UNCOMPRESSED}" ]; then
77 +               kallsymopt="${kallsymopt} --uncompressed"
78 +       fi
79 +
80         local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL}               \
81                       ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}"
82  
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.
88          */
89 +#ifdef CONFIG_KALLSYMS_UNCOMPRESSED
90 +       memcpy(result, data + 1, len - 1);
91 +       result += len - 1;
92 +       len = 0;
93 +#endif
94         while (len) {
95                 tptr = &kallsyms_token_table[kallsyms_token_index[*data]];
96                 data++;
97 @@ -145,6 +150,9 @@ tail:
98   */
99  static char kallsyms_get_symbol_type(unsigned int off)
100  {
101 +#ifdef CONFIG_KALLSYMS_UNCOMPRESSED
102 +       return kallsyms_names[off + 1];
103 +#endif
104         /*
105          * Get just the first code, look it up in the token table,
106          * and return the first char from this token.