diff mbox series

[linux-riscv,J] UBUNTU: SAUCE: scripts/Makefile.modinst discard-locals from modules

Message ID 20220309161622.124754-1-dimitri.ledkov@canonical.com
State New
Headers show
Series [linux-riscv,J] UBUNTU: SAUCE: scripts/Makefile.modinst discard-locals from modules | expand

Commit Message

Dimitri John Ledkov March 9, 2022, 4:16 p.m. UTC
On riscv, it appears that all kernel modules are generated with an
excesive amount of local symbols and assembly automatic generated
symbols increasing the size of stripped .ko modules multiple times
over similar ones on other architectures. When stripping .ko on riscv,
discard these local symbols too, which should make our module sizes
somewhat more reasonable.

BugLink: https://bugs.launchpad.net/bugs/1964335

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
---

 This makes kernel install 863MB smaller, and everything appears to
 work fine. I.e. loaded btrfs module, mounted btrfs filesystem,
 unmounted it, etc.

 scripts/Makefile.modinst | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Andrea Righi March 9, 2022, 4:19 p.m. UTC | #1
On Wed, Mar 09, 2022 at 04:16:22PM +0000, Dimitri John Ledkov wrote:
> On riscv, it appears that all kernel modules are generated with an
> excesive amount of local symbols and assembly automatic generated
> symbols increasing the size of stripped .ko modules multiple times
> over similar ones on other architectures. When stripping .ko on riscv,
> discard these local symbols too, which should make our module sizes
> somewhat more reasonable.
> 
> BugLink: https://bugs.launchpad.net/bugs/1964335
> 
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
> Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>

Looks good to me! Also thanks for testing this out!

Acked-by: Andrea Righi <andrea.righi@canonical.com>

> ---
> 
>  This makes kernel install 863MB smaller, and everything appears to
>  work fine. I.e. loaded btrfs module, mounted btrfs filesystem,
>  unmounted it, etc.
> 
>  scripts/Makefile.modinst | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
> index ff9b09e4cf..373d6953ad 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
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Dimitri John Ledkov March 14, 2022, 11:31 a.m. UTC | #2
Applied.
diff mbox series

Patch

diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index ff9b09e4cf..373d6953ad 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