* [PATCH v3] scripts: Do not strip .rela.dyn section
@ 2025-04-08 7:28 Alexandre Ghiti
2025-04-21 6:04 ` Alexandre Ghiti
2025-05-08 16:52 ` patchwork-bot+linux-riscv
0 siblings, 2 replies; 3+ messages in thread
From: Alexandre Ghiti @ 2025-04-08 7:28 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Alexandre Ghiti,
Björn Töpel, Masahiro Yamada, Nathan Chancellor,
Nicolas Schier, Ard Biesheuvel, Charlie Jenkins, linux-kernel,
linux-riscv, linux-kbuild
Cc: Alexandre Ghiti
The .rela.dyn section contains runtime relocations and is only emitted
for a relocatable kernel.
riscv uses this section to relocate the kernel at runtime but that section
is stripped from vmlinux. That prevents kexec to successfully load vmlinux
since it does not contain the relocations info needed.
Fixes: 559d1e45a16d ("riscv: Use --emit-relocs in order to move .rela.dyn in init")
Tested-by: Björn Töpel <bjorn@rivosinc.com>
Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
---
Changes in v3:
- Rebase on top of 6.15-rc1
- Change the fixes tag
Changes in v2:
- Changelog modification (Ard)
- Remove ARCH_WANTS_RELA_DYN (Ard)
scripts/Makefile.vmlinux | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux
index b0a6cd5b818c..85d60d986401 100644
--- a/scripts/Makefile.vmlinux
+++ b/scripts/Makefile.vmlinux
@@ -13,7 +13,7 @@ ifdef CONFIG_ARCH_VMLINUX_NEEDS_RELOCS
vmlinux-final := vmlinux.unstripped
quiet_cmd_strip_relocs = RSTRIP $@
- cmd_strip_relocs = $(OBJCOPY) --remove-section='.rel*' $< $@
+ cmd_strip_relocs = $(OBJCOPY) --remove-section='.rel*' --remove-section=!'.rel*.dyn' $< $@
vmlinux: $(vmlinux-final) FORCE
$(call if_changed,strip_relocs)
--
2.39.2
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v3] scripts: Do not strip .rela.dyn section
2025-04-08 7:28 [PATCH v3] scripts: Do not strip .rela.dyn section Alexandre Ghiti
@ 2025-04-21 6:04 ` Alexandre Ghiti
2025-05-08 16:52 ` patchwork-bot+linux-riscv
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Ghiti @ 2025-04-21 6:04 UTC (permalink / raw)
To: Alexandre Ghiti, Paul Walmsley, Palmer Dabbelt,
Björn Töpel, Masahiro Yamada, Nathan Chancellor,
Nicolas Schier, Ard Biesheuvel, Charlie Jenkins, linux-kernel,
linux-riscv, linux-kbuild
Hi Masahiro,
On 08/04/2025 09:28, Alexandre Ghiti wrote:
> The .rela.dyn section contains runtime relocations and is only emitted
> for a relocatable kernel.
>
> riscv uses this section to relocate the kernel at runtime but that section
> is stripped from vmlinux. That prevents kexec to successfully load vmlinux
> since it does not contain the relocations info needed.
>
> Fixes: 559d1e45a16d ("riscv: Use --emit-relocs in order to move .rela.dyn in init")
> Tested-by: Björn Töpel <bjorn@rivosinc.com>
> Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
> Acked-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> ---
>
> Changes in v3:
> - Rebase on top of 6.15-rc1
> - Change the fixes tag
>
> Changes in v2:
> - Changelog modification (Ard)
> - Remove ARCH_WANTS_RELA_DYN (Ard)
>
> scripts/Makefile.vmlinux | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux
> index b0a6cd5b818c..85d60d986401 100644
> --- a/scripts/Makefile.vmlinux
> +++ b/scripts/Makefile.vmlinux
> @@ -13,7 +13,7 @@ ifdef CONFIG_ARCH_VMLINUX_NEEDS_RELOCS
> vmlinux-final := vmlinux.unstripped
>
> quiet_cmd_strip_relocs = RSTRIP $@
> - cmd_strip_relocs = $(OBJCOPY) --remove-section='.rel*' $< $@
> + cmd_strip_relocs = $(OBJCOPY) --remove-section='.rel*' --remove-section=!'.rel*.dyn' $< $@
>
> vmlinux: $(vmlinux-final) FORCE
> $(call if_changed,strip_relocs)
Do you think you can merge that in the next rc? If not, I can merge it
if you add your AB :)
Thanks,
Alex
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v3] scripts: Do not strip .rela.dyn section
2025-04-08 7:28 [PATCH v3] scripts: Do not strip .rela.dyn section Alexandre Ghiti
2025-04-21 6:04 ` Alexandre Ghiti
@ 2025-05-08 16:52 ` patchwork-bot+linux-riscv
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+linux-riscv @ 2025-05-08 16:52 UTC (permalink / raw)
To: Alexandre Ghiti
Cc: linux-riscv, paul.walmsley, palmer, alex, bjorn, masahiroy,
nathan, nicolas, ardb, charlie, linux-kernel, linux-kbuild
Hello:
This patch was applied to riscv/linux.git (fixes)
by Alexandre Ghiti <alexghiti@rivosinc.com>:
On Tue, 8 Apr 2025 09:28:51 +0200 you wrote:
> The .rela.dyn section contains runtime relocations and is only emitted
> for a relocatable kernel.
>
> riscv uses this section to relocate the kernel at runtime but that section
> is stripped from vmlinux. That prevents kexec to successfully load vmlinux
> since it does not contain the relocations info needed.
>
> [...]
Here is the summary with links:
- [v3] scripts: Do not strip .rela.dyn section
https://git.kernel.org/riscv/c/e9d86b8e17e7
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-08 17:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08 7:28 [PATCH v3] scripts: Do not strip .rela.dyn section Alexandre Ghiti
2025-04-21 6:04 ` Alexandre Ghiti
2025-05-08 16:52 ` patchwork-bot+linux-riscv
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox