[PATCH v2 4/8] riscv: enable HAVE_TRIM_UNUSED_SYSCALLS when toolchain supports DCE
Yuan Tan
tanyuan at tinylab.org
Tue Oct 14 23:18:31 PDT 2025
From: Yuhang Zheng <z1652074432 at gmail.com>
Enable HAVE_TRIM_UNUSED_SYSCALLS on RISC-V when the toolchain supports dead
code and data elimination.
This allows the unused syscalls and related code to be trimmed at link time
based on the list of actually used syscalls.
While this enables per-syscall elimination, some syscall entries still
cannot be fully discarded due to sections that are force-kept by the
linker, such as ex_table, bug_table, jump_table, and .alternative.
Signed-off-by: Yuhang Zheng <z1652074432 at gmail.com>
Signed-off-by: Yuan Tan <tanyuan at tinylab.org>
Signed-off-by: Zhangjin Wu <falcon at tinylab.org>
---
arch/riscv/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 0c6038dc5dfd..697050ac8c62 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -198,6 +198,7 @@ config RISCV
select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
select HAVE_STACKPROTECTOR
select HAVE_SYSCALL_TRACEPOINTS
+ select HAVE_TRIM_UNUSED_SYSCALLS
select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU
select IRQ_DOMAIN
select IRQ_FORCED_THREADING
--
2.43.0
More information about the linux-riscv
mailing list