Skip to contentSkip to conversation

m68k: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

PATCH In review Arnd Bergmann 3 participants 3 messages Feb 25, 2021 m68k architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 m68k: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

From: Arnd Bergmann <[email protected]>

While experimenting with CONFIG_TRIM_UNUSED_KSYMS across architectures, I noticed that this unsurprisingly works best when combined with the --gc-sections linker flag, which is not currently allowed on m68k.

Enabling it with this patch shows significant improvements for kernel size, looking at m68k defconfig with gcc-10, I get

4005135 1374302 167108 5546545 54a231 vmlinux-normal 3916254 1378078 167108 5461440 5355c0 vmlinux+trim 4012933 1362514 164280 5539727 54878f vmlinux+gcsection 3797884 1334194 164640 5296718 50d24e vmlinux+gcsection+trim

There are probably bugs somewhere, but if someone is able to test this patch and fix any issues that come up, would be a useful improvement for memory-limited machines.

---
 arch/m68k/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/m68k/Kconfig +1 -0
index c186733562b3..5f1aafa7b2e2 100644
@@ -24,6 +24,7 @@ config M68K
 	select HAVE_DEBUG_BUGVERBOSE
 	select HAVE_FUTEX_CMPXCHG if MMU && FUTEX
 	select HAVE_IDE
+	select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
 	select HAVE_MOD_ARCH_SPECIFIC
 	select HAVE_UID16
 	select MMU_GATHER_NO_RANGE if MMU
Signature · 1 line
2.29.2
#1 lore raw

Hi Arnd!

Quoted 9 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

While experimenting with CONFIG_TRIM_UNUSED_KSYMS across architectures, I noticed that this unsurprisingly works best when combined with the --gc-sections linker flag, which is not currently allowed on m68k.

Enabling it with this patch shows significant improvements for kernel size, looking at m68k defconfig with gcc-10, I get

Quoted 8 lines

4005135 1374302 167108 5546545 54a231 vmlinux-normal 3916254 1378078 167108 5461440 5355c0 vmlinux+trim 4012933 1362514 164280 5539727 54878f vmlinux+gcsection 3797884 1334194 164640 5296718 50d24e vmlinux+gcsection+trim

There are probably bugs somewhere, but if someone is able to test this patch and fix any issues that come up, would be a useful improvement for memory-limited machines.

Thanks, that sounds like a very helpful improvement. I'll test the patch next week when I'm on vacation and report back if it works - unless someone beats me to it ;-).

Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 14 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

While experimenting with CONFIG_TRIM_UNUSED_KSYMS across architectures, I noticed that this unsurprisingly works best when combined with the --gc-sections linker flag, which is not currently allowed on m68k.

Enabling it with this patch shows significant improvements for kernel size, looking at m68k defconfig with gcc-10, I get

4005135 1374302 167108 5546545 54a231 vmlinux-normal 3916254 1378078 167108 5461440 5355c0 vmlinux+trim 4012933 1362514 164280 5539727 54878f vmlinux+gcsection 3797884 1334194 164640 5296718 50d24e vmlinux+gcsection+trim

Quoted 6 lines

There are probably bugs somewhere, but if someone is able to test this patch and fix any issues that come up, would be a useful improvement for memory-limited machines.

Signature · 1 line
Kees Cook