linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION
@ 2023-05-23 16:54 Jisheng Zhang
  2023-05-23 16:54 ` [PATCH v2 1/4] riscv: move options to keep entries sorted Jisheng Zhang
                   ` (4 more replies)
  0 siblings, 5 replies; 38+ messages in thread
From: Jisheng Zhang @ 2023-05-23 16:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Arnd Bergmann
  Cc: linux-riscv, linux-kernel, linux-arch

When trying to run linux with various opensource riscv core on
resource limited FPGA platforms, for example, those FPGAs with less
than 16MB SDRAM, I want to save mem as much as possible. One of the
major technologies is kernel size optimizations, I found that riscv
does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, which
passes -fdata-sections, -ffunction-sections to CFLAGS and passes the
--gc-sections flag to the linker.

This not only benefits my case on FPGA but also benefits defconfigs.
Here are some notable improvements from enabling this with defconfigs:

nommu_k210_defconfig:
   text    data     bss     dec     hex
1112009  410288   59837 1582134  182436     before
 962838  376656   51285 1390779  1538bb     after

rv32_defconfig:
   text    data     bss     dec     hex
8804455 2816544  290577 11911576 b5c198     before
8692295 2779872  288977 11761144 b375f8     after

defconfig:
   text    data     bss     dec     hex
9438267 3391332  485333 13314932 cb2b74     before
9285914 3350052  483349 13119315 c82f53     after

patch1 and patch2 are clean ups.
patch3 fixes a typo.
patch4 finally enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION for riscv.

NOTE: Zhangjin Wu firstly sent out a patch to enable dead code
elimination for riscv several months ago, I didn't notice it until
yesterday. Although it missed some preparations and some sections's
keeping, he is the first person to enable this feature for riscv. To
ease merging, this series take his patch into my entire series and
makes patch4 authored by him after getting his ack to reflect
the above fact.

Since v1:
  - collect Reviewed-by, Tested-by tag
  - Make patch4 authored by Zhangjin Wu, add my co-developed-by tag

Jisheng Zhang (3):
  riscv: move options to keep entries sorted
  riscv: vmlinux-xip.lds.S: remove .alternative section
  vmlinux.lds.h: use correct .init.data.* section name

Zhangjin Wu (1):
  riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

 arch/riscv/Kconfig                  |  13 +-
 arch/riscv/kernel/vmlinux-xip.lds.S |   6 -
 arch/riscv/kernel/vmlinux.lds.S     |   6 +-
 include/asm-generic/vmlinux.lds.h   |   2 +-
 4 files changed, 11 insertions(+), 16 deletions(-)

-- 
2.40.1


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

end of thread, other threads:[~2023-07-22  0:38 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-23 16:54 [PATCH v2 0/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Jisheng Zhang
2023-05-23 16:54 ` [PATCH v2 1/4] riscv: move options to keep entries sorted Jisheng Zhang
2023-05-25 14:01   ` Conor Dooley
2023-06-01  4:48   ` Guo Ren
2023-05-23 16:55 ` [PATCH v2 2/4] riscv: vmlinux-xip.lds.S: remove .alternative section Jisheng Zhang
2023-06-01  4:43   ` Guo Ren
2023-05-23 16:55 ` [PATCH v2 3/4] vmlinux.lds.h: use correct .init.data.* section name Jisheng Zhang
2023-05-24 11:02   ` Kefeng Wang
2023-05-23 16:55 ` [PATCH v2 4/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Jisheng Zhang
2023-05-24 11:04   ` Kefeng Wang
2023-06-14 14:49 ` [PATCH v2 0/4] " Palmer Dabbelt
2023-06-14 16:25   ` Jisheng Zhang
2023-06-15 13:54     ` Palmer Dabbelt
2023-06-19 22:06       ` Palmer Dabbelt
2023-06-20 20:05         ` Nick Desaulniers
2023-06-20 20:13           ` Conor Dooley
2023-06-20 20:32             ` Nick Desaulniers
2023-06-20 20:41               ` Palmer Dabbelt
2023-06-20 20:47                 ` Nick Desaulniers
2023-06-20 21:08                   ` Palmer Dabbelt
2023-06-21  0:13                     ` Palmer Dabbelt
2023-06-21 14:53                       ` Palmer Dabbelt
2023-06-21 16:42                         ` Conor Dooley
2023-06-21 17:23                           ` Conor Dooley
2023-06-21 17:51                           ` Björn Töpel
2023-06-21 18:19                             ` Palmer Dabbelt
2023-06-21 19:46                               ` Palmer Dabbelt
2023-06-22 21:40                                 ` Nick Desaulniers
2023-06-22 21:42                                   ` Palmer Dabbelt
2023-06-22 21:53                               ` Nathan Chancellor
2023-06-22 22:16                                 ` Palmer Dabbelt
2023-06-22 23:18                                   ` Nathan Chancellor
2023-06-23 17:17                                     ` Nick Desaulniers
2023-06-25 12:24                                       ` Jisheng Zhang
2023-06-25 12:43                                         ` Conor Dooley
2023-06-25 20:05                                           ` Palmer Dabbelt
2023-06-25 20:06                                             ` Palmer Dabbelt
2023-07-22  0:37                                             ` Fangrui Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).