riscv: do not select MODULE_SECTIONS by default
PATCH 1/1 riscv: do not select MODULE_SECTIONS by default
From: Qingfang Deng <[email protected]>
Since commit aad15bc85c18 ("riscv: Change code model of module to medany to improve data accessing"), kernel modules have not been built with -fPIC, so they wouldn't have R_RISCV_GOT_HI20 or R_RISCV_CALL_PLT relocations, and handling of those relocations is unnecessary.
If RELOCATABLE=y, kernel modules will be built with -fPIE, which would reintroduce said relocations, so only select MODULE_SECTIONS when RELOCATABLE.
--- arch/riscv/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/Kconfig +1 -1
@@ -169,7 +169,6 @@ config RISCV select LOCK_MM_AND_FIND_VMA select MMU_GATHER_RCU_TABLE_FREE if SMP && MMU select MODULES_USE_ELF_RELA if MODULES - select MODULE_SECTIONS if MODULES select OF select OF_EARLY_FLATTREE select OF_IRQ
@@ -858,6 +857,7 @@ config PARAVIRT_TIME_ACCOUNTING config RELOCATABLE bool "Build a relocatable kernel" depends on MMU && 64BIT && !XIP_KERNEL + select MODULE_SECTIONS if MODULES help This builds a kernel as a Position Independent Executable (PIE), which retains all relocation metadata required to relocate the
Signature · 1 line
2.34.1
Quoted 44 lines · Qingfang Deng
From: Qingfang Deng <[email protected]>
Since commit
aad15bc85c18("riscv: Change code model of module to medany to improve data accessing"), kernel modules have not been built with -fPIC, so they wouldn't haveR_RISCV_GOT_HI20orR_RISCV_CALL_PLTrelocations, and handling of those relocations is unnecessary.If RELOCATABLE=y, kernel modules will be built with -fPIE, which would reintroduce said relocations, so only select
MODULE_SECTIONSwhen RELOCATABLE.Signed-off-by Qingfang Deng <[email protected]>--- arch/riscv/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/Kconfig +1
-1@@ -169,7 +169,6 @@ config RISCV select LOCK_MM_AND_FIND_VMA select MMU_GATHER_RCU_TABLE_FREE if SMP && MMU select MODULES_USE_ELF_RELA if MODULES - select MODULE_SECTIONS if MODULES select OF select OF_EARLY_FLATTREE select OF_IRQ@@ -858,6 +857,7 @@ config PARAVIRT_TIME_ACCOUNTING config RELOCATABLE bool "Build a relocatable kernel" depends on MMU && 64BIT && !XIP_KERNEL + select MODULE_SECTIONS if MODULES help This builds a kernel as a Position Independent Executable (PIE), which retains all relocation metadata required to relocate theSignature · 7 lines
2.34.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Looks great!
This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:
Hello:
This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:
Quoted 8 lines · On Sat, 11 May 2024 09:57:25 +0800 you wrote:
From: Qingfang Deng <[email protected]>
Since commit
aad15bc85c18("riscv: Change code model of module to medany to improve data accessing"), kernel modules have not been built with -fPIC, so they wouldn't haveR_RISCV_GOT_HI20orR_RISCV_CALL_PLTrelocations, and handling of those relocations is unnecessary.[...]
Here is the summary with links:
- riscv: do not select MODULE_SECTIONS by default
https://git.kernel.org/riscv/c/2ae376aa0cd2
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html