Skip to content

Commit 020925c

Browse files
liu-song-6kees
authored andcommitted
kallsyms: Do not cleanup .llvm.<hash> suffix before sorting symbols
Cleaning up the symbols causes various issues afterwards. Let's sort the list based on original name. Signed-off-by: Song Liu <[email protected]> Fixes: 8cc32a9 ("kallsyms: strip LTO-only suffixes from promoted global functions") Reviewed-by: Masami Hiramatsu (Google) <[email protected]> Tested-by: Masami Hiramatsu (Google) <[email protected]> Acked-by: Petr Mladek <[email protected]> Reviewed-by: Sami Tolvanen <[email protected]> Reviewed-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent 92e9bac commit 020925c

File tree

2 files changed

+2
-33
lines changed

2 files changed

+2
-33
lines changed

scripts/kallsyms.c

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
* This software may be used and distributed according to the terms
66
* of the GNU General Public License, incorporated herein by reference.
77
*
8-
* Usage: kallsyms [--all-symbols] [--absolute-percpu]
9-
* [--lto-clang] in.map > out.S
8+
* Usage: kallsyms [--all-symbols] [--absolute-percpu] in.map > out.S
109
*
1110
* Table compression uses all the unused char codes on the symbols and
1211
* maps these to the most used substrings (tokens). For instance, it might
@@ -62,7 +61,6 @@ static struct sym_entry **table;
6261
static unsigned int table_size, table_cnt;
6362
static int all_symbols;
6463
static int absolute_percpu;
65-
static int lto_clang;
6664

6765
static int token_profit[0x10000];
6866

@@ -73,8 +71,7 @@ static unsigned char best_table_len[256];
7371

7472
static void usage(void)
7573
{
76-
fprintf(stderr, "Usage: kallsyms [--all-symbols] [--absolute-percpu] "
77-
"[--lto-clang] in.map > out.S\n");
74+
fprintf(stderr, "Usage: kallsyms [--all-symbols] [--absolute-percpu] in.map > out.S\n");
7875
exit(1);
7976
}
8077

@@ -344,25 +341,6 @@ static bool symbol_absolute(const struct sym_entry *s)
344341
return s->percpu_absolute;
345342
}
346343

347-
static void cleanup_symbol_name(char *s)
348-
{
349-
char *p;
350-
351-
/*
352-
* ASCII[.] = 2e
353-
* ASCII[0-9] = 30,39
354-
* ASCII[A-Z] = 41,5a
355-
* ASCII[_] = 5f
356-
* ASCII[a-z] = 61,7a
357-
*
358-
* As above, replacing the first '.' in ".llvm." with '\0' does not
359-
* affect the main sorting, but it helps us with subsorting.
360-
*/
361-
p = strstr(s, ".llvm.");
362-
if (p)
363-
*p = '\0';
364-
}
365-
366344
static int compare_names(const void *a, const void *b)
367345
{
368346
int ret;
@@ -526,10 +504,6 @@ static void write_src(void)
526504
output_address(relative_base);
527505
printf("\n");
528506

529-
if (lto_clang)
530-
for (i = 0; i < table_cnt; i++)
531-
cleanup_symbol_name((char *)table[i]->sym);
532-
533507
sort_symbols_by_name();
534508
output_label("kallsyms_seqs_of_names");
535509
for (i = 0; i < table_cnt; i++)
@@ -807,7 +781,6 @@ int main(int argc, char **argv)
807781
static const struct option long_options[] = {
808782
{"all-symbols", no_argument, &all_symbols, 1},
809783
{"absolute-percpu", no_argument, &absolute_percpu, 1},
810-
{"lto-clang", no_argument, &lto_clang, 1},
811784
{},
812785
};
813786

scripts/link-vmlinux.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,6 @@ kallsyms()
156156
kallsymopt="${kallsymopt} --absolute-percpu"
157157
fi
158158

159-
if is_enabled CONFIG_LTO_CLANG; then
160-
kallsymopt="${kallsymopt} --lto-clang"
161-
fi
162-
163159
info KSYMS "${2}.S"
164160
scripts/kallsyms ${kallsymopt} "${1}" > "${2}.S"
165161

0 commit comments

Comments
 (0)