History

scripts/kallsyms: exclude symbols generated by itself dynamically

Drop the symbols generated by scripts/kallsyms itself automatically instead of maintaining the symbol list manually. Pass the kallsyms object from the previous kallsyms step (if it exists) as the third parameter of scripts/mksysmap, which will weed out the generated symbols from the input to the next kallsyms step.

Masahiro Yamada committed 3 years ago

Commit ca09bf41 parent c4802043 files · +13 −20Browse files

Showing the changes to scripts (3 of 3 files). Show all

Unified · Split

3 files
  1. scripts/kallsyms.c +0 −16
  2. scripts/link-vmlinux.sh +3 −3
  3. scripts/mksysmap +10 −1
scripts/kallsyms.c+0−16
@@ -104,22 +104,6 @@ static bool is_ignored_symbol(const char *name, char type) · 103 unmodified lines
104104 {
105105 /* Symbol names that exactly match to the following are ignored.*/
106106 static const char * const ignored_symbols[] = {
107− /*
108− * Symbols which vary between passes. Passes 1 and 2 must have
109− * identical symbol lists. The kallsyms_* symbols below are
110− * only added after pass 1, they would be included in pass 2
111− * when --all-symbols is specified so exclude them to get a
112− * stable symbol list.
113− */
114− "kallsyms_addresses",
115− "kallsyms_offsets",
116− "kallsyms_relative_base",
117− "kallsyms_num_syms",
118− "kallsyms_names",
119− "kallsyms_markers",
120− "kallsyms_token_table",
121− "kallsyms_token_index",
122− "kallsyms_seqs_of_names",
123107 /* Exclude linker generated symbols which vary between passes */
124108 "_SDA_BASE_", /* ppc */
125109 "_SDA2_BASE_", /* ppc */
scripts/link-vmlinux.sh+3−3
@@ -174,7 +174,7 @@ kallsyms_step() · 173 unmodified lines
174174 kallsyms_S=${kallsyms_vmlinux}.S
175175
176176 vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o}
177− mksysmap ${kallsyms_vmlinux} ${kallsyms_vmlinux}.syms
177+ mksysmap ${kallsyms_vmlinux} ${kallsyms_vmlinux}.syms ${kallsymso_prev}
178178 kallsyms ${kallsyms_vmlinux}.syms ${kallsyms_S}
179179
180180 info AS ${kallsyms_S}
@@ -188,7 +188,7 @@ kallsyms_step() · 7 unmodified lines
188188 mksysmap()
189189 {
190190 info NM ${2}
191− ${CONFIG_SHELL} "${srctree}/scripts/mksysmap" ${1} ${2}
191+ ${CONFIG_SHELL} "${srctree}/scripts/mksysmap" ${1} ${2} ${3}
192192 }
193193
194194 sorttable()
@@ -277,7 +277,7 @@ if is_enabled CONFIG_DEBUG_INFO_BTF && is_enabled CONFIG_BPF; then · 82 unmodified lines
277277 ${RESOLVE_BTFIDS} vmlinux
278278 fi
279279
280−mksysmap vmlinux System.map
280+mksysmap vmlinux System.map ${kallsymso}
281281
282282 if is_enabled CONFIG_BUILDTIME_TABLE_SORT; then
283283 info SORTTAB vmlinux
scripts/mksysmap+10−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
44 # tools to retrieve the actual addresses of symbols in the kernel.
55 #
66 # Usage
7−# mksysmap vmlinux System.map
7+# mksysmap vmlinux System.map [exclude]
88
99
1010 #####
@@ -52,4 +52,13 @@ ${NM} -n ${1} | sed >${2} -e " · 41 unmodified lines
5252
5353 # for LoongArch?
5454 / L0$/d
55+
56+# ---------------------------------------------------------------------------
57+# Ignored kallsyms symbols
58+#
59+# If the 3rd parameter exists, symbols from it will be omitted from the output.
60+# This makes kallsyms have the identical symbol lists in the step 1 and 2.
61+# Without this, the step2 would get new symbols generated by scripts/kallsyms.c
62+# when CONFIG_KALLSYMS_ALL is enabled. That might require one more pass.
63+$(if [ $# -ge 3 ]; then ${NM} ${3} | sed -n '/ U /!s:.* \([^ ]*\)$:/ \1$/d:p'; fi)
5564 "

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t