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

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
104{104{
105 /* Symbol names that exactly match to the following are ignored.*/105 /* Symbol names that exactly match to the following are ignored.*/
106 static const char * const ignored_symbols[] = {106 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",
123 /* Exclude linker generated symbols which vary between passes */107 /* Exclude linker generated symbols which vary between passes */
124 "_SDA_BASE_", /* ppc */108 "_SDA_BASE_", /* ppc */
125 "_SDA2_BASE_", /* ppc */109 "_SDA2_BASE_", /* ppc */
scripts/link-vmlinux.sh+3−3
@@ -174,7 +174,7 @@ kallsyms_step() · 173 unmodified lines
174 kallsyms_S=${kallsyms_vmlinux}.S174 kallsyms_S=${kallsyms_vmlinux}.S
175 175
176 vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o}176 vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o}
177 mksysmap ${kallsyms_vmlinux} ${kallsyms_vmlinux}.syms177 mksysmap ${kallsyms_vmlinux} ${kallsyms_vmlinux}.syms ${kallsymso_prev}
178 kallsyms ${kallsyms_vmlinux}.syms ${kallsyms_S}178 kallsyms ${kallsyms_vmlinux}.syms ${kallsyms_S}
179 179
180 info AS ${kallsyms_S}180 info AS ${kallsyms_S}
@@ -188,7 +188,7 @@ kallsyms_step() · 7 unmodified lines
188mksysmap()188mksysmap()
189{189{
190 info NM ${2}190 info NM ${2}
191 ${CONFIG_SHELL} "${srctree}/scripts/mksysmap" ${1} ${2}191 ${CONFIG_SHELL} "${srctree}/scripts/mksysmap" ${1} ${2} ${3}
192}192}
193 193
194sorttable()194sorttable()
@@ -277,7 +277,7 @@ if is_enabled CONFIG_DEBUG_INFO_BTF && is_enabled CONFIG_BPF; then · 82 unmodified lines
277 ${RESOLVE_BTFIDS} vmlinux277 ${RESOLVE_BTFIDS} vmlinux
278fi278fi
279 279
280mksysmap vmlinux System.map280mksysmap vmlinux System.map ${kallsymso}
281 281
282if is_enabled CONFIG_BUILDTIME_TABLE_SORT; then282if is_enabled CONFIG_BUILDTIME_TABLE_SORT; then
283 info SORTTAB vmlinux283 info SORTTAB vmlinux
scripts/mksysmap+10−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
4# tools to retrieve the actual addresses of symbols in the kernel.4# tools to retrieve the actual addresses of symbols in the kernel.
5#5#
6# Usage6# Usage
7# mksysmap vmlinux System.map7# mksysmap vmlinux System.map [exclude]
8 8
9 9
10#####10#####
@@ -52,4 +52,13 @@ ${NM} -n ${1} | sed >${2} -e " · 41 unmodified lines
52 52
53# for LoongArch?53# for LoongArch?
54/ L0$/d54/ 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)
55"64"

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