[PATCH] kbuild: scripts/Makefile.modinst discard-locals from modules on riscv

Dimitri John Ledkov dimitri.ledkov at canonical.com
Wed Mar 30 06:11:39 PDT 2022


On riscv, GNU toolchain generated ~800MB+ of local symbols in .ko
files on riscv. When stripping .ko on riscv, discard these local
symbols by default to make .ko module sizes comparable to other
architectures.

This patch is tested on SiFive Unmatched and is shipped in
Ubuntu. This can be revisited once improved GNU toolchain becomes
available and is used.

Link: https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1036

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>
---
 scripts/Makefile.modinst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index c2c43a0ecfe0..fc8fc19ed754 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -46,7 +46,11 @@ quiet_cmd_install = INSTALL $@
 ifdef INSTALL_MOD_STRIP
 
 ifeq ($(INSTALL_MOD_STRIP),1)
+ifeq ($(ARCH),riscv)
+strip-option := --strip-debug --discard-locals
+else
 strip-option := --strip-debug
+endif
 else
 strip-option := $(INSTALL_MOD_STRIP)
 endif
-- 
2.32.0




More information about the linux-riscv mailing list