[<prev] [next>] [day] [month] [year] [list]
Message-ID: <31FE3D0D64425B42+b7172d7ef4e6fa3ee3ed543a44dbc5e467df4da4.1760463245.git.tanyuan@tinylab.org>
Date: Wed, 15 Oct 2025 14:18:58 +0800
From: Yuan Tan <tanyuan@...ylab.org>
To: arnd@...db.de,
masahiroy@...nel.org,
nathan@...nel.org,
palmer@...belt.com,
linux-kbuild@...r.kernel.org,
linux-riscv@...ts.infradead.org
Cc: linux-arch@...r.kernel.org,
linux-kernel@...r.kernel.org,
i@...kray.me,
tanyuan@...ylab.org,
falcon@...ylab.org,
ronbogo@...look.com,
z1652074432@...il.com,
lx24@....ynu.edu.cn
Subject: [PATCH v2 5/8] kconfig: add CONFIG_PUSHSECTION_WITH_RELOC for relocation support
If the assembler supports the '.reloc' directive with 'BFD_RELOC_NONE', we
can establish a reference between a section created by '.pushsection' and
its caller function by emitting a relocation in the caller.
Known toolchain minimums:
- GNU binutils (gas) >= 2.26
- LLVM integrated assembler (IAS) >= 13.0.0
All assemblers meeting the kernel's minimum toolchain requirements already
support it.
Signed-off-by: Yuan Tan <tanyuan@...ylab.org>
Signed-off-by: Zhangjin Wu <falcon@...ylab.org>
Signed-off-by: Peihan Liu <ronbogo@...look.com>
---
init/Kconfig | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/init/Kconfig b/init/Kconfig
index 2c6f86c44d96..3d1cf32d5407 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1631,6 +1631,10 @@ config HAVE_PCSPKR_PLATFORM
config HAVE_TRIM_UNUSED_SYSCALLS
bool
+config AS_HAS_BFD_RELOC_NONE
+ bool
+ def_bool $(as-instr,.reloc .$(comma) BFD_RELOC_NONE$(comma))
+
menuconfig EXPERT
bool "Configure standard kernel features (expert users)"
# Unhide debug options, to make the on-by-default options visible
@@ -1965,6 +1969,18 @@ config USED_SYSCALLS
If unsure, please disable TRIM_UNUSED_SYSCALLS.
+config PUSHSECTION_WITH_RELOC
+ bool "Trim more syscalls"
+ depends on TRIM_UNUSED_SYSCALLS && AS_HAS_BFD_RELOC_NONE
+ default y
+ help
+ Enable building relocation-based references between sections created
+ by '.pushsection' and their caller functions when the assembler
+ supports the '.reloc' directive.
+
+ This allows the linker to establish proper dependencies, remove the
+ need for KEEP().
+
config KALLSYMS
bool "Load all symbols for debugging/ksymoops" if EXPERT
default y
--
2.43.0
Powered by blists - more mailing lists