History log of /linux-master/scripts/mksysmap
Revision Date Author Comments
# a951884d 15-Feb-2024 Arnd Bergmann <arnd@arndb.de>

kallsyms: ignore ARMv4 thunks along with others

lld is now able to build ARMv4 and ARMv4T kernels, which means it can
generate thunks for those (__ARMv4PILongThunk_*, __ARMv4PILongBXThunk_*)
that can interfere with kallsyms table generation since they do not get
ignore like the corresponding ARMv5+ ones are:

Inconsistent kallsyms data
Try "make KALLSYMS_EXTRA_PASS=1" as a workaround

Replace the hardcoded list of thunk symbols with a more general regex that
covers this one along with future symbols that follow the same pattern.

Fixes: 5eb6e280432d ("ARM: 9289/1: Allow pre-ARMv5 builds with ld.lld 16.0.0 and newer")
Fixes: efe6e3068067 ("kallsyms: fix nonconverging kallsyms table with lld")
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 71025b85 25-Jun-2023 Pierre-Clément Tosi <ptosi@google.com>

scripts/mksysmap: Ignore prefixed KCFI symbols

The (relatively) new KCFI feature in LLVM/Clang encodes type information
for C functions by generating symbols named __kcfi_typeid_<fname>, which
can then be referenced from assembly. However, some custom build rules
(e.g. nVHE or early PIE on arm64) use objcopy to add a prefix to all the
symbols in their object files, making mksysmap's ignore filter miss
those KCFI symbols.

Therefore, explicitly list those twice-prefixed KCFI symbols as ignored.

Alternatively, this could also be achieved in a less verbose way by
ignoring any symbol containing the string "__kcfi_typeid_". However,
listing the combined prefixes explicitly saves us from running the small
risk of ignoring symbols that should be kept.

Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 200dd957 06-Jun-2023 Pierre-Clément Tosi <ptosi@google.com>

scripts/mksysmap: Ignore __pi_ local arm64 symbols

Similarly to "__kvm_nvhe_", filter out any local symbol that was
prefixed with "__pi_" (generated when CONFIG_RANDOMIZE_BASE=y) when
compiling System.map and in kallsyms.

Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# ec336aa8 06-Jun-2023 Pierre-Clément Tosi <ptosi@google.com>

scripts/mksysmap: Fix badly escaped '$'

The backslash characters escaping '$' in the command to sed (intended to
prevent it from interpreting '$' as "end-of-line") are currently being
consumed by the Shell (where they mean that sh should not evaluate what
follows '$' as a variable name). This means that

sed -e "/ \$/d"

executes the script

/ $/d

instead of the intended

/ \$/d

So escape twice in mksysmap any '$' that actually needs to reach sed
escaped so that the backslash survives the Shell.

Fixes: c4802044a0a7 ("scripts/mksysmap: use sed with in-line comments")
Fixes: 320e7c9d4494 ("scripts/kallsyms: move compiler-generated symbol patterns to mksysmap")
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 320e7c9d 08-Mar-2023 Masahiro Yamada <masahiroy@kernel.org>

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 c17a2538704f ("mksysmap: Fix
the mismatch of 'L0' symbols in System.map").

They were separately maintained prior to commit 94ff2f63d6a3 ("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>


# ca09bf48 08-Mar-2023 Masahiro Yamada <masahiroy@kernel.org>

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.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# c4802044 08-Mar-2023 Masahiro Yamada <masahiroy@kernel.org>

scripts/mksysmap: use sed with in-line comments

It is not feasible to insert comments in a multi-line shell command.
Use sed, and move comments close to the code.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# e9f76363 08-Mar-2023 Masahiro Yamada <masahiroy@kernel.org>

scripts/mksysmap: remove comments described in nm(1)

I do not think we need to repeat what is written in 'man nm'.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# d32b55f4 26-Sep-2022 Masahiro Yamada <masahiroy@kernel.org>

kallsyms: ignore __kstrtab_* and __kstrtabns_* symbols

Every EXPORT_SYMBOL creates __kstrtab_* and __kstrtabns_*, which
consumes 15-20% of the kallsyms entries.

For example, on the system built from the x86_64 defconfig,

$ cat /proc/kallsyms | wc
129527 388581 5685465
$ cat /proc/kallsyms | grep __kstrtab | wc
23489 70467 1187932

We already ignore __crc_* symbols populated by EXPORT_SYMBOL, so it
should be fine to ignore __kstrtab_* and __kstrtabns_* as well.

This makes vmlinux a bit smaller.

$ size vmlinux.before vmlinux.after
text data bss dec hex filename
22785374 8559694 1413328 32758396 1f3da7c vmlinux.before
22785374 8137806 1413328 32336508 1ed6a7c vmlinux.after

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# a2833d1b 26-Sep-2022 Masahiro Yamada <masahiroy@kernel.org>

kallsyms: drop duplicated ignore patterns from kallsyms.c

Now that kallsyms.c parses the output from mksysmap, some symbols have
already been dropped.

Move comments to scripts/mksysmap. Also, make the grep command readable.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# c1346169 26-Sep-2022 Masahiro Yamada <masahiroy@kernel.org>

mksysmap: update comment about __crc_*

Since commit 7b4537199a4a ("kbuild: link symbol CRCs at final link,
removing CONFIG_MODULE_REL_CRCS"), __crc_* symbols never become
absolute.

Keep ignoring __crc_*, but update the comment.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# c17a2538 01-Sep-2022 Youling Tang <tangyouling@loongson.cn>

mksysmap: Fix the mismatch of 'L0' symbols in System.map

When System.map was generated, the kernel used mksysmap to filter the
kernel symbols, we need to filter "L0" symbols in LoongArch architecture.

$ cat System.map | grep L0
9000000000221540 t L0

The L0 symbol exists in System.map, but not in .tmp_System.map. When
"cmp -s System.map .tmp_System.map" will show "Inconsistent kallsyms
data" error message in link-vmlinux.sh script.

Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 72d24acc 02-Jun-2020 ashimida <ashimida@linux.alibaba.com>

mksysmap: Fix the mismatch of '.L' symbols in System.map

When System.map was generated, the kernel used mksysmap to
filter the kernel symbols, but all the symbols with the
second letter 'L' in the kernel were filtered out, not just
the symbols starting with 'dot + L'.

For example:
ashimida@ubuntu:~/linux$ cat System.map |grep ' .L'
ashimida@ubuntu:~/linux$ nm -n vmlinux |grep ' .L'
ffff0000088028e0 t bLength_show
......
ffff0000092e0408 b PLLP_OUTC_lock
ffff0000092e0410 b PLLP_OUTA_lock

The original intent should be to filter out all local symbols
starting with '.L', so the dot should be escaped.

Fixes: 00902e984732 ("mksysmap: Add h8300 local symbol pattern")
Signed-off-by: ashimida <ashimida@linux.alibaba.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 00902e98 09-Mar-2015 Yoshinori Sato <ysato@users.sourceforge.jp>

mksysmap: Add h8300 local symbol pattern

h8300's nm output have a lot of local symbols.
ex)
00000000 N .Lframe0
00000013 N .LLST1
00000026 N .LLST2
00000039 N .LLST3
0000004c N .LLST4
Added new pattern " .L" to filter rule.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>


# 06ed5c2b 20-Aug-2014 Michal Marek <mmarek@suse.cz>

kbuild: Make scripts executable

The Makefiles call the respective interpreter explicitly, but this makes
it easier to use the scripts manually.

Signed-off-by: Michal Marek <mmarek@suse.cz>


# 7eb6e340 28-May-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: trivial - remove trailing empty lines

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>


# 4fec5420 13-Jul-2012 Masatake YAMATO <yamato@redhat.com>

trivial: typo in comment in mksysmap

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 2ea03891 14-Jan-2009 Sam Ravnborg <sam@ravnborg.org>

Revert "kbuild: strip generated symbols from *.ko"

This reverts commit ad7a953c522ceb496611d127e51e278bfe0ff483.

And commit: ("allow stripping of generated symbols under CONFIG_KALLSYMS_ALL")
9bb482476c6c9d1ae033306440c51ceac93ea80c

These stripping patches has caused a set of issues:

1) People have reported compatibility issues with binutils due to
lack of support for `--strip-unneeded-symbols' with objcopy 2.15.92.0.2
Reported by: Wenji
2) ccache and distcc no longer works as expeced
Reported by: Ted, Roland, + others
3) The installed modules increased a lot in size
Reported by: Ted, Davej + others

Reported-by: Wenji Huang <wenji.huang@oracle.com>
Reported-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: Dave Jones <davej@redhat.com>
Reported-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# ad7a953c 16-Dec-2008 Jan Beulich <jbeulich@novell.com>

kbuild: strip generated symbols from *.ko

This patch changes the way __crc_ symbols are being resolved from
using ld to do so to using the assembler, thus allowing these symbols
to be marked local (the linker creates then as global ones) and hence
allow stripping (for modules) or ignoring (for vmlinux) them. While at
this, also strip other generated symbols during module installation.

One potentially debatable point is the handling of the flags passeed
to gcc when translating the intermediate assembly file into an object:
passing $(c_flags) unchanged doesn't work as gcc passes --gdwarf2 to
gas whenever is sees any -g* option, even for -g0, and despite the
fact that the compiler would have already produced all necessary debug
info in the C->assembly translation phase. I took the approach of just
filtering out all -g* options, but an alternative to such negative
filtering might be to have a positive filter which might, in the ideal
case allow just all the -Wa,* options to pass through.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# aab34ac8 19-May-2008 Sam Ravnborg <sam@ravnborg.org>

kbuild: filter away debug symbols from kernel symbols

Andi Kleen <andi@firstfloor.org>
reported that he saw a lot of symbols like this:

0000000000000b24 N DW.aio.h.903a6d92.2
0000000000000bce N DW.task_io_accounting.h.8d8de327.0
0000000000000bec N DW.hrtimer.h.c23659c6.0

in his System.map / kallsyms output.

Simple solution is to skip all debugging
symbols (they are marked 'N').

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Paulo Marques <pmarques@grupopie.com>


# 943ffb58 09-Jan-2006 Adrian Bunk <bunk@stusta.de>

spelling: s/retreive/retrieve/

Signed-off-by: Adrian Bunk <bunk@stusta.de>


# 1da177e4 16-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org>

Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!