]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
module, riscv: force sh_addr=0 for arch-specific sections
authorPetr Pavlu <petr.pavlu@suse.com>
Fri, 27 Mar 2026 07:59:03 +0000 (08:59 +0100)
committerSami Tolvanen <samitolvanen@google.com>
Tue, 26 May 2026 20:45:59 +0000 (20:45 +0000)
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 riscv-specific module sections.

Link: https://sourceware.org/bugzilla/show_bug.cgi?id=33958
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
arch/riscv/include/asm/module.lds.h

index 1075beae1ac64521e4c98eadf9acc785deb93d3e..9ced27c8ccb627480384a6fd472ed9b0c4f779ef 100644 (file)
@@ -2,8 +2,8 @@
 /* Copyright (C) 2017 Andes Technology Corporation */
 #ifdef CONFIG_MODULE_SECTIONS
 SECTIONS {
-       .plt : { BYTE(0) }
-       .got : { BYTE(0) }
-       .got.plt : { BYTE(0) }
+       .plt : { BYTE(0) }
+       .got : { BYTE(0) }
+       .got.plt : { BYTE(0) }
 }
 #endif