Linux kbuild/kconfig development
 help / color / mirror / Atom feed
* [PATCH] kbuild: try readelf first in gen_symversions
@ 2026-06-03 16:17 Wentao Guan
  2026-06-04  1:38 ` Nathan Chancellor
  0 siblings, 1 reply; 5+ messages in thread
From: Wentao Guan @ 2026-06-03 16:17 UTC (permalink / raw)
  To: nathan; +Cc: nsc, tamird, linux-kbuild, linux-kernel, petr.pavlu, Wentao Guan

Use readelf to dig out if <file>.o contain a __export_symbol_*.

Instead of nm, readelf is more faster, and significantly improve speed
when enable CONFIG_MODVERSIONS.

Build x86_64_defconfigs in 2C4T cloud server with CONFIG_MODVERSIONS=y:
With patch:
real    17m21.019s
user    61m48.388s
sys     4m27.709s
Without patch:
real    17m39.435s
user    62m24.686s
sys     5m3.200s

Link: https://lore.kernel.org/all/tencent_2FA16E0A18D6D0C0703F5D49@qq.com/
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
---
 scripts/Makefile.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 3498d25b15e85..54a91bc144cce 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -233,7 +233,7 @@ ifdef CONFIG_MODVERSIONS
 #   be compiled and linked to the kernel and/or modules.
 
 gen_symversions =								\
-	if $(NM) $@ 2>/dev/null | grep -q ' __export_symbol_'; then		\
+	if $(READELF) -sW $@ 2>/dev/null | grep -q ' __export_symbol_'; then		\
 		$(cmd_gensymtypes_$1) >> $(dot-target).cmd;			\
 	fi
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-06-05 11:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-03 16:17 [PATCH] kbuild: try readelf first in gen_symversions Wentao Guan
2026-06-04  1:38 ` Nathan Chancellor
2026-06-04  3:44   ` Wentao Guan
2026-06-05  6:22     ` Nathan Chancellor
2026-06-05 11:03       ` Wentao Guan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox