From: Petr Pavlu <petr.pavlu@suse.com>
To: Russell King <linux@armlinux.org.uk>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Sami Tolvanen <samitolvanen@google.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>,
Luis Chamberlain <mcgrof@kernel.org>,
Petr Pavlu <petr.pavlu@suse.com>,
Daniel Gomez <da.gomez@kernel.org>,
Aaron Tomlin <atomlin@atomlin.com>,
Joe Lawrence <joe.lawrence@redhat.com>,
linux-arm-kernel@lists.infradead.org,
linux-m68k@lists.linux-m68k.org, linux-riscv@lists.infradead.org,
linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] module, arm64: force sh_addr=0 for arch-specific sections
Date: Fri, 27 Mar 2026 08:59:01 +0100 [thread overview]
Message-ID: <20260327080023.861105-3-petr.pavlu@suse.com> (raw)
In-Reply-To: <20260327080023.861105-1-petr.pavlu@suse.com>
When linking modules with 'ld.bfd -r', sections defined without an address
inherit the location counter, resulting in non-zero sh_addr values in the
resulting .ko files. Relocatable objects are expected to have sh_addr=0 for
all sections. Non-zero addresses are confusing in this context, typically
worse compressible, and may cause tools to misbehave [1].
Force sh_addr=0 for all arm64-specific module sections.
Link: https://sourceware.org/bugzilla/show_bug.cgi?id=33958 [1]
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
---
Note that the definition of .text.hot hasn't matched any input sections
since commit 1ba9f8979426 ("vmlinux.lds: Unify TEXT_MAIN, DATA_MAIN, and
related macros"), and even before that with CONFIG_LTO_CLANG=y.
The preceding comment also explains that the directive is necessary to
merge section groups. However, this approach seems suboptimal. A better
method would be to link modules using --force-group-allocation to retain
only one copy of each group.
I plan to look at this separately.
---
arch/arm64/include/asm/module.lds.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/include/asm/module.lds.h b/arch/arm64/include/asm/module.lds.h
index fb944b46846d..0b3aacd22c59 100644
--- a/arch/arm64/include/asm/module.lds.h
+++ b/arch/arm64/include/asm/module.lds.h
@@ -14,7 +14,7 @@ SECTIONS {
* directive to force them into a single section and silence the
* warning.
*/
- .text.hot : { *(.text.hot) }
+ .text.hot 0 : { *(.text.hot) }
#endif
#ifdef CONFIG_UNWIND_TABLES
@@ -22,6 +22,6 @@ SECTIONS {
* Currently, we only use unwind info at module load time, so we can
* put it into the .init allocation.
*/
- .init.eh_frame : { *(.eh_frame) }
+ .init.eh_frame 0 : { *(.eh_frame) }
#endif
}
--
2.53.0
next prev parent reply other threads:[~2026-03-27 8:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-27 7:58 [PATCH 0/4] module: force sh_addr=0 for arch-specific sections Petr Pavlu
2026-03-27 7:59 ` [PATCH 1/4] module, arm: " Petr Pavlu
2026-03-27 7:59 ` Petr Pavlu [this message]
2026-03-27 7:59 ` [PATCH 3/4] module, m68k: " Petr Pavlu
2026-03-27 7:59 ` [PATCH 4/4] module, riscv: " Petr Pavlu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260327080023.861105-3-petr.pavlu@suse.com \
--to=petr.pavlu@suse.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=atomlin@atomlin.com \
--cc=catalin.marinas@arm.com \
--cc=da.gomez@kernel.org \
--cc=geert@linux-m68k.org \
--cc=joe.lawrence@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-modules@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=mcgrof@kernel.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=samitolvanen@google.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox