Skip to content

Commit 1221365

Browse files
committed
module.lds.S: Fix modules on 32-bit parisc architecture
On the 32-bit parisc architecture, we always used the -ffunction-sections compiler option to tell the compiler to put the functions into seperate text sections. This is necessary, otherwise "big" kernel modules like ext4 or ipv6 fail to load because some branches won't be able to reach their stubs. Commit 1ba9f89 ("vmlinux.lds: Unify TEXT_MAIN, DATA_MAIN, and related macros") broke this for parisc because all text sections will get unconditionally merged now. Introduce the ARCH_WANTS_MODULES_TEXT_SECTIONS config option which avoids the text section merge for modules, and fix this issue by enabling this option by default for 32-bit parisc. Fixes: 1ba9f89 ("vmlinux.lds: Unify TEXT_MAIN, DATA_MAIN, and related macros") Cc: Josh Poimboeuf <jpoimboe@kernel.org> Cc: stable@vger.kernel.org # v6.19+ Suggested-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-by: Petr Pavlu <petr.pavlu@suse.com> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 3dce917 commit 1221365

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

arch/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,13 @@ config ARCH_WANTS_MODULES_DATA_IN_VMALLOC
11271127
For architectures like powerpc/32 which have constraints on module
11281128
allocation and need to allocate module data outside of module area.
11291129

1130+
config ARCH_WANTS_MODULES_TEXT_SECTIONS
1131+
bool
1132+
help
1133+
For architectures like 32-bit parisc which require that functions in
1134+
modules have to keep code in own text sections (-ffunction-sections)
1135+
and to avoid merging all text into one big text section,
1136+
11301137
config ARCH_WANTS_EXECMEM_LATE
11311138
bool
11321139
help

arch/parisc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ config PARISC
88
select HAVE_FUNCTION_GRAPH_TRACER
99
select HAVE_SYSCALL_TRACEPOINTS
1010
select ARCH_WANT_FRAME_POINTERS
11+
select ARCH_WANTS_MODULES_TEXT_SECTIONS if !64BIT
1112
select ARCH_HAS_CPU_CACHE_ALIASING
1213
select ARCH_HAS_DMA_ALLOC if PA11
1314
select ARCH_HAS_DMA_OPS

scripts/module.lds.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ SECTIONS {
4040
__kcfi_traps 0 : { KEEP(*(.kcfi_traps)) }
4141
#endif
4242

43+
#ifndef CONFIG_ARCH_WANTS_MODULES_TEXT_SECTIONS
4344
.text 0 : {
4445
*(.text .text.[0-9a-zA-Z_]*)
4546
}
47+
#endif
4648

4749
.bss 0 : {
4850
*(.bss .bss.[0-9a-zA-Z_]*)

0 commit comments

Comments
 (0)