[PATCH 38/46] Kbuild, lto: don't include weak source file symbols in System.map
From: Jiri Slaby (SUSE)
Date: Mon Nov 14 2022 - 06:48:24 EST
From: Andi Kleen <andi@xxxxxxxxxxxxxx>
The gcc LTO build can generate some extra weak source code file name
symbols on the second kallsyms link like:
0000000002fdf20a W head64.c.552cf5a6
This causes the "Inconsistent kallsyms data" error due to mismatches in
the stage1 vs stage2 kallsyms link. Filter those out when generating
the System.map.
Cc: Masahiro Yamada <masahiroy@xxxxxxxxxx>
Cc: Michal Marek <michal.lkml@xxxxxxxxxxx>
Cc: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
Cc: linux-kbuild@xxxxxxxxxxxxxxx
Signed-off-by: Andi Kleen <andi@xxxxxxxxxxxxxx>
Signed-off-by: Martin Liska <mliska@xxxxxxx>
Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
---
scripts/mksysmap | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/mksysmap b/scripts/mksysmap
index 16a08b8ef2f8..0f19a44ab136 100755
--- a/scripts/mksysmap
+++ b/scripts/mksysmap
@@ -34,6 +34,7 @@
# U - undefined global symbols
# N - debugging symbols
# w - local weak symbols
+# W - weak symbols if they contain .c.
# readprofile starts reading symbols when _stext is found, and
# continue until it finds a symbol which is not either of 'T', 't',
@@ -57,4 +58,5 @@ $NM -n $1 | grep -v \
-e ' __kstrtab_' \
-e ' __kstrtabns_' \
-e ' L0$' \
+ -e ' W .*\.c\.' \
> $2
--
2.38.1