Skip to content

Commit 320e7c9

Browse files
committed
scripts/kallsyms: move compiler-generated symbol patterns to mksysmap
scripts/kallsyms.c maintains compiler-generated symbols, but we end up with something similar in scripts/mksysmap to avoid the "Inconsistent kallsyms data" error. For example, commit c17a253 ("mksysmap: Fix the mismatch of 'L0' symbols in System.map"). They were separately maintained prior to commit 94ff2f6 ("kbuild: reuse mksysmap output for kallsyms"). Now that scripts/kallsyms.c parses the output of scripts/mksysmap, it makes more sense to collect all the ignored patterns to mksysmap. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
1 parent ca09bf4 commit 320e7c9

2 files changed

Lines changed: 43 additions & 60 deletions

File tree

scripts/kallsyms.c

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -102,66 +102,6 @@ static char *sym_name(const struct sym_entry *s)
102102

103103
static bool is_ignored_symbol(const char *name, char type)
104104
{
105-
/* Symbol names that exactly match to the following are ignored.*/
106-
static const char * const ignored_symbols[] = {
107-
/* Exclude linker generated symbols which vary between passes */
108-
"_SDA_BASE_", /* ppc */
109-
"_SDA2_BASE_", /* ppc */
110-
NULL
111-
};
112-
113-
/* Symbol names that begin with the following are ignored.*/
114-
static const char * const ignored_prefixes[] = {
115-
"__efistub_", /* arm64 EFI stub namespace */
116-
"__kvm_nvhe_$", /* arm64 local symbols in non-VHE KVM namespace */
117-
"__kvm_nvhe_.L", /* arm64 local symbols in non-VHE KVM namespace */
118-
"__AArch64ADRPThunk_", /* arm64 lld */
119-
"__ARMV5PILongThunk_", /* arm lld */
120-
"__ARMV7PILongThunk_",
121-
"__ThumbV7PILongThunk_",
122-
"__LA25Thunk_", /* mips lld */
123-
"__microLA25Thunk_",
124-
"__kcfi_typeid_", /* CFI type identifiers */
125-
NULL
126-
};
127-
128-
/* Symbol names that end with the following are ignored.*/
129-
static const char * const ignored_suffixes[] = {
130-
"_from_arm", /* arm */
131-
"_from_thumb", /* arm */
132-
"_veneer", /* arm */
133-
NULL
134-
};
135-
136-
/* Symbol names that contain the following are ignored.*/
137-
static const char * const ignored_matches[] = {
138-
".long_branch.", /* ppc stub */
139-
".plt_branch.", /* ppc stub */
140-
NULL
141-
};
142-
143-
const char * const *p;
144-
145-
for (p = ignored_symbols; *p; p++)
146-
if (!strcmp(name, *p))
147-
return true;
148-
149-
for (p = ignored_prefixes; *p; p++)
150-
if (!strncmp(name, *p, strlen(*p)))
151-
return true;
152-
153-
for (p = ignored_suffixes; *p; p++) {
154-
int l = strlen(name) - strlen(*p);
155-
156-
if (l >= 0 && !strcmp(name + l, *p))
157-
return true;
158-
}
159-
160-
for (p = ignored_matches; *p; p++) {
161-
if (strstr(name, *p))
162-
return true;
163-
}
164-
165105
if (type == 'u' || type == 'n')
166106
return true;
167107

scripts/mksysmap

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,28 @@ ${NM} -n ${1} | sed >${2} -e "
3737
# local labels, .LBB, .Ltmpxxx, .L__unnamed_xx, .LASANPC, etc.
3838
/ \.L/d
3939
40+
# arm64 EFI stub namespace
41+
/ __efistub_/d
42+
43+
# arm64 local symbols in non-VHE KVM namespace
44+
/ __kvm_nvhe_\$/d
45+
/ __kvm_nvhe_\.L/d
46+
47+
# arm64 lld
48+
/ __AArch64ADRPThunk_/d
49+
50+
# arm lld
51+
/ __ARMV5PILongThunk_/d
52+
/ __ARMV7PILongThunk_/d
53+
/ __ThumbV7PILongThunk_/d
54+
55+
# mips lld
56+
/ __LA25Thunk_/d
57+
/ __microLA25Thunk_/d
58+
59+
# CFI type identifiers
60+
/ __kcfi_typeid_/d
61+
4062
# CRC from modversions
4163
/ __crc_/d
4264
@@ -46,13 +68,34 @@ ${NM} -n ${1} | sed >${2} -e "
4668
# EXPORT_SYMBOL (namespace)
4769
/ __kstrtabns_/d
4870
71+
# ---------------------------------------------------------------------------
72+
# Ignored suffixes
73+
# (do not forget '$' after each pattern)
74+
75+
# arm
76+
/_from_arm$/d
77+
/_from_thumb$/d
78+
/_veneer$/d
79+
4980
# ---------------------------------------------------------------------------
5081
# Ignored symbols (exact match)
5182
# (do not forget a space before and '$' after each pattern)
5283
5384
# for LoongArch?
5485
/ L0$/d
5586
87+
# ppc
88+
/ _SDA_BASE_$/d
89+
/ _SDA2_BASE_$/d
90+
91+
# ---------------------------------------------------------------------------
92+
# Ignored patterns
93+
# (symbols that contain the pattern are ignored)
94+
95+
# ppc stub
96+
/\.long_branch\./d
97+
/\.plt_branch\./d
98+
5699
# ---------------------------------------------------------------------------
57100
# Ignored kallsyms symbols
58101
#

0 commit comments

Comments
 (0)