[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <c1c9913c0974b96faaab664ef354cf8775cd7554.1699025537.git.tanyuan@tinylab.org>
Date: Sat, 4 Nov 2023 00:01:01 +0800
From: Yuan Tan <tanyuan@...ylab.org>
To: falcon@...ylab.org, arnd@...db.de, linux-kernel@...r.kernel.org,
linux-mips@...r.kernel.org, linux-riscv@...ts.infradead.org,
luc.vanoostenryck@...il.com, linux-sparse@...r.kernel.org
Cc: linux@...ssschuh.net, palmer@...osinc.com,
paul.walmsley@...ive.com, paulburton@...nel.org,
paulmck@...nel.org, tim.bird@...y.com, tsbogend@...ha.franken.de,
w@....eu, tanyuan@...ylab.org, i@...kray.me
Subject: [PATCH v1 08/14] DCE/DSE: add choice of methods to build reference for orphan sections
Due to .pushsection producing orphan sections, the kernel currently uses
`KEEP()` in the linker script to address this issue.
Here we purpose two methods to build reference for pushed section,
SHF_LINK_ORDER method and SECTION_SHF_GROUP method.
The binary files compiled using both methods turn out to be identical,
and it doesn't produce any side effects.
Signed-off-by: Yuan Tan <tanyuan@...ylab.org>
Signed-off-by: Zhangjin Wu <falcon@...ylab.org>
---
init/Kconfig | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/init/Kconfig b/init/Kconfig
index 9834dbb0ddae..9599d2de44e8 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1740,6 +1740,56 @@ config USED_SYSCALLS
If unsure, please disable TRIM_UNUSED_SYSCALLS.
+choice
+ prompt "Trim methods" if EXPERT
+ default RESTRICTED_TRIM_UNUSED_SYSCALLS
+ depends on TRIM_UNUSED_SYSCALLS
+ help
+ This option selects the method to trim unused syscall wrongly kept.
+
+ The binary files compiled using both methods are identical.
+
+ If the trim methods is not specified, some syscalls are kept by
+ linker script and can not be trimmed.
+
+config RESTRICTED_TRIM_UNUSED_SYSCALLS
+ bool "Leave some kept syscalls (EXPERIMENTAL)" if EXPERT
+ help
+ Say Y here to trim 'unused' syscalls wrongly kept by __ex_table
+ like sections in kernel space.
+
+ Some syscalls are kept by linker script and can not be trimmed.
+
+ If unsure, choose this.
+
+config SECTION_SHF_LINK_ORDER_SUPPORT
+ bool "Using SHF_LINK_ORDER attribute (EXPERIMENTAL)" if EXPERT
+ depends on HAVE_SECTION_SHF_LINK_ORDER_SUPPORT
+ help
+ Say Y here to trim more 'unused' syscalls wrongly kept by __ex_table
+ like sections in kernel space.
+
+ This option uses the SHF_LINK_ORDER attribute to build references for
+ orphan sections. Therefore, these sections are no longer kept in the
+ linker script.
+
+ If unsure, not choose this.
+
+config SECTION_SHF_GROUP_SUPPORT
+ bool "Using SHF_GROUP attribute (EXPERIMENTAL)" if EXPERT
+ depends on HAVE_SECTION_SHF_GROUP_SUPPORT
+ help
+ Say Y here to trim more 'unused' syscalls wrongly kept by __ex_table
+ like sections in kernel space.
+
+ This option uses the SHF_GROUP attribute to build references for
+ orphan sections. Therefore, these sections are no longer kept in the
+ linker script.
+
+ If unsure, not choose this.
+
+endchoice
+
config KALLSYMS
bool "Load all symbols for debugging/ksymoops" if EXPERT
default y
--
2.34.1
Powered by blists - more mailing lists