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.
Unified · Split
| @@ -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 */ |
| @@ -174,7 +174,7 @@ kallsyms_step() · 173 unmodified lines | |||
| 174 | kallsyms_S=${kallsyms_vmlinux}.S | 174 | 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}.syms | 177 | 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 | |||
| 188 | mksysmap() | 188 | mksysmap() |
| 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 | ||
| 194 | sorttable() | 194 | sorttable() |
| @@ -277,7 +277,7 @@ if is_enabled CONFIG_DEBUG_INFO_BTF && is_enabled CONFIG_BPF; then · 82 unmodified lines | |||
| 277 | ${RESOLVE_BTFIDS} vmlinux | 277 | ${RESOLVE_BTFIDS} vmlinux |
| 278 | fi | 278 | fi |
| 279 | 279 | ||
| 280 | mksysmap vmlinux System.map | 280 | mksysmap vmlinux System.map ${kallsymso} |
| 281 | 281 | ||
| 282 | if is_enabled CONFIG_BUILDTIME_TABLE_SORT; then | 282 | if is_enabled CONFIG_BUILDTIME_TABLE_SORT; then |
| 283 | info SORTTAB vmlinux | 283 | info SORTTAB vmlinux |
| @@ -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 | # Usage | 6 | # Usage |
| 7 | # mksysmap vmlinux System.map | 7 | # 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$/d | 54 | / 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 | " |