Merge tag 'v6.1.42' of git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable into odroidg12-6.1.y

This is the 6.1.42 stable release

Change-Id: I8ce26df42f1e5d2faa6a77c93514341dfe8b76d9
This commit is contained in:
Mauro (mdrjr) Ribeiro
2023-08-03 11:17:15 -03:00
167 changed files with 2997 additions and 1567 deletions

View File

@@ -5,7 +5,8 @@
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
* Usage: nm -n vmlinux | scripts/kallsyms [--all-symbols] > symbols.S
* Usage: kallsyms [--all-symbols] [--absolute-percpu]
* [--base-relative] [--lto-clang] in.map > out.S
*
* Table compression uses all the unused char codes on the symbols and
* maps these to the most used substrings (tokens). For instance, it might
@@ -49,6 +50,7 @@ _Static_assert(
struct sym_entry {
unsigned long long addr;
unsigned int len;
unsigned int seq;
unsigned int start_pos;
unsigned int percpu_absolute;
unsigned char sym[];
@@ -77,6 +79,7 @@ static unsigned int table_size, table_cnt;
static int all_symbols;
static int absolute_percpu;
static int base_relative;
static int lto_clang;
static int token_profit[0x10000];
@@ -88,7 +91,7 @@ static unsigned char best_table_len[256];
static void usage(void)
{
fprintf(stderr, "Usage: kallsyms [--all-symbols] [--absolute-percpu] "
"[--base-relative] in.map > out.S\n");
"[--base-relative] [--lto-clang] in.map > out.S\n");
exit(1);
}
@@ -116,6 +119,7 @@ static bool is_ignored_symbol(const char *name, char type)
"kallsyms_markers",
"kallsyms_token_table",
"kallsyms_token_index",
"kallsyms_seqs_of_names",
/* Exclude linker generated symbols which vary between passes */
"_SDA_BASE_", /* ppc */
"_SDA2_BASE_", /* ppc */
@@ -410,6 +414,65 @@ static int symbol_absolute(const struct sym_entry *s)
return s->percpu_absolute;
}
static char * s_name(char *buf)
{
/* Skip the symbol type */
return buf + 1;
}
static void cleanup_symbol_name(char *s)
{
char *p;
if (!lto_clang)
return;
/*
* ASCII[.] = 2e
* ASCII[0-9] = 30,39
* ASCII[A-Z] = 41,5a
* ASCII[_] = 5f
* ASCII[a-z] = 61,7a
*
* As above, replacing the first '.' in ".llvm." with '\0' does not
* affect the main sorting, but it helps us with subsorting.
*/
p = strstr(s, ".llvm.");
if (p)
*p = '\0';
}
static int compare_names(const void *a, const void *b)
{
int ret;
char sa_namebuf[KSYM_NAME_LEN];
char sb_namebuf[KSYM_NAME_LEN];
const struct sym_entry *sa = *(const struct sym_entry **)a;
const struct sym_entry *sb = *(const struct sym_entry **)b;
expand_symbol(sa->sym, sa->len, sa_namebuf);
expand_symbol(sb->sym, sb->len, sb_namebuf);
cleanup_symbol_name(s_name(sa_namebuf));
cleanup_symbol_name(s_name(sb_namebuf));
ret = strcmp(s_name(sa_namebuf), s_name(sb_namebuf));
if (!ret) {
if (sa->addr > sb->addr)
return 1;
else if (sa->addr < sb->addr)
return -1;
/* keep old order */
return (int)(sa->seq - sb->seq);
}
return ret;
}
static void sort_symbols_by_name(void)
{
qsort(table, table_cnt, sizeof(table[0]), compare_names);
}
static void write_src(void)
{
unsigned int i, k, off;
@@ -495,6 +558,7 @@ static void write_src(void)
for (i = 0; i < table_cnt; i++) {
if ((i & 0xFF) == 0)
markers[i >> 8] = off;
table[i]->seq = i;
/* There cannot be any symbol of length zero. */
if (table[i]->len == 0) {
@@ -535,6 +599,12 @@ static void write_src(void)
free(markers);
sort_symbols_by_name();
output_label("kallsyms_seqs_of_names");
for (i = 0; i < table_cnt; i++)
printf("\t.long\t%u\n", table[i]->seq);
printf("\n");
output_label("kallsyms_token_table");
off = 0;
for (i = 0; i < 256; i++) {
@@ -818,6 +888,7 @@ int main(int argc, char **argv)
{"all-symbols", no_argument, &all_symbols, 1},
{"absolute-percpu", no_argument, &absolute_percpu, 1},
{"base-relative", no_argument, &base_relative, 1},
{"lto-clang", no_argument, &lto_clang, 1},
{},
};

View File

@@ -156,6 +156,10 @@ kallsyms()
kallsymopt="${kallsymopt} --base-relative"
fi
if is_enabled CONFIG_LTO_CLANG; then
kallsymopt="${kallsymopt} --lto-clang"
fi
info KSYMS ${2}
scripts/kallsyms ${kallsymopt} ${1} > ${2}
}