* [PATCH] riscv: relocate R_RISCV_CALL_PLT in kexec_file @ 2023-03-10 18:27 Torsten Duwe 2023-03-13 3:13 ` Li Zhengyu 0 siblings, 1 reply; 5+ messages in thread From: Torsten Duwe @ 2023-03-10 18:27 UTC (permalink / raw) To: Li Zhengyu, Paul Walmsley, Conor Dooley, Palmer Dabbelt Cc: Albert Ou, Li Huafei, Liao Chang, linux-riscv, linux-kernel Depending on the toolchain (here: gcc-12, binutils-2.40) the relocation entries for function calls are no longer R_RISCV_CALL, but R_RISCV_CALL_PLT. When trying kexec_load_file on such kernels, it will fail with kexec_image: Unknown rela relocation: 19 kexec_image: Error loading purgatory ret=-8 The binary code at the call site remains the same, so tell arch_kexec_apply_relocations_add() to handle _PLT alike. fixes: 838b3e28488f702 ("Load purgatory in kexec_file") Signed-off-by: Torsten Duwe <duwe@suse.de> Cc: stable@vger.kernel.org --- --- a/arch/riscv/kernel/elf_kexec.c +++ b/arch/riscv/kernel/elf_kexec.c @@ -425,6 +425,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, * sym, instead of searching the whole relsec. */ case R_RISCV_PCREL_HI20: + case R_RISCV_CALL_PLT: case R_RISCV_CALL: *(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) | ENCODE_UJTYPE_IMM(val - addr); _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] riscv: relocate R_RISCV_CALL_PLT in kexec_file 2023-03-10 18:27 [PATCH] riscv: relocate R_RISCV_CALL_PLT in kexec_file Torsten Duwe @ 2023-03-13 3:13 ` Li Zhengyu 2023-03-21 15:03 ` Torsten Duwe 0 siblings, 1 reply; 5+ messages in thread From: Li Zhengyu @ 2023-03-13 3:13 UTC (permalink / raw) To: Torsten Duwe, Paul Walmsley, Conor Dooley, Palmer Dabbelt Cc: Albert Ou, Li Huafei, Liao Chang, linux-riscv, linux-kernel, liubao918 On Fri, 10 Mar 2023 19:27:03 +0100, Torsten Duwe <duwe@lst.de> wrote: > Depending on the toolchain (here: gcc-12, binutils-2.40) the > relocation entries for function calls are no longer R_RISCV_CALL, but > R_RISCV_CALL_PLT. When trying kexec_load_file on such kernels, it will > fail with > > kexec_image: Unknown rela relocation: 19 > kexec_image: Error loading purgatory ret=-8 > > The binary code at the call site remains the same, so tell > arch_kexec_apply_relocations_add() to handle _PLT alike. R_RISCV_CALL has already been deprecated, and replaced by R_RISCV_CALL_PLT. See Enum 18-19 in Table 3. Relocation types from https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc . It was deprecated in ("Deprecated R_RISCV_CALL, prefer R_RISCV_CALL_PLT") https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0 > > fixes: 838b3e28488f702 ("Load purgatory in kexec_file") > Signed-off-by: Torsten Duwe <duwe@suse.de> > Cc: stable@vger.kernel.org > > --- > --- a/arch/riscv/kernel/elf_kexec.c > +++ b/arch/riscv/kernel/elf_kexec.c > @@ -425,6 +425,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, > * sym, instead of searching the whole relsec. > */ > case R_RISCV_PCREL_HI20: > + case R_RISCV_CALL_PLT: > case R_RISCV_CALL: > *(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) | > ENCODE_UJTYPE_IMM(val - addr); > > . Palmer, please apply these references to the commit message. Reviewed-by: Li Zhengyu <lizhengyu3@huawei.com> _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] riscv: relocate R_RISCV_CALL_PLT in kexec_file 2023-03-13 3:13 ` Li Zhengyu @ 2023-03-21 15:03 ` Torsten Duwe 2023-03-21 15:35 ` Conor Dooley 0 siblings, 1 reply; 5+ messages in thread From: Torsten Duwe @ 2023-03-21 15:03 UTC (permalink / raw) To: Palmer Dabbelt Cc: Li Zhengyu, Paul Walmsley, Conor Dooley, Albert Ou, Li Huafei, Liao Chang, linux-riscv, linux-kernel, liubao918 On Mon, 13 Mar 2023 11:13:17 +0800 Li Zhengyu <lizhengyu3@huawei.com> wrote: > On Fri, 10 Mar 2023 19:27:03 +0100, Torsten Duwe <duwe@lst.de> wrote: > > Depending on the toolchain (here: gcc-12, binutils-2.40) the > > relocation entries for function calls are no longer R_RISCV_CALL, but > > R_RISCV_CALL_PLT. When trying kexec_load_file on such kernels, it will > > fail with > > > > kexec_image: Unknown rela relocation: 19 > > kexec_image: Error loading purgatory ret=-8 > > > > The binary code at the call site remains the same, so tell > > arch_kexec_apply_relocations_add() to handle _PLT alike. > > R_RISCV_CALL has already been deprecated, and replaced by R_RISCV_CALL_PLT. > > See Enum 18-19 in Table 3. Relocation types from > https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc > . > > It was deprecated in ("Deprecated R_RISCV_CALL, prefer > R_RISCV_CALL_PLT") > https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0 > > > > > fixes: 838b3e28488f702 ("Load purgatory in kexec_file") > > Signed-off-by: Torsten Duwe <duwe@suse.de> > > Cc: stable@vger.kernel.org > > > > --- > > --- a/arch/riscv/kernel/elf_kexec.c > > +++ b/arch/riscv/kernel/elf_kexec.c > > @@ -425,6 +425,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, > > * sym, instead of searching the whole relsec. > > */ > > case R_RISCV_PCREL_HI20: > > + case R_RISCV_CALL_PLT: > > case R_RISCV_CALL: > > *(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) | > > ENCODE_UJTYPE_IMM(val - addr); > > > > . > > Palmer, please apply these references to the commit message. > > Reviewed-by: Li Zhengyu <lizhengyu3@huawei.com> > Ping? _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] riscv: relocate R_RISCV_CALL_PLT in kexec_file 2023-03-21 15:03 ` Torsten Duwe @ 2023-03-21 15:35 ` Conor Dooley 2023-07-23 10:27 ` Conor Dooley 0 siblings, 1 reply; 5+ messages in thread From: Conor Dooley @ 2023-03-21 15:35 UTC (permalink / raw) To: Torsten Duwe Cc: Palmer Dabbelt, Li Zhengyu, Paul Walmsley, Albert Ou, Li Huafei, Liao Chang, linux-riscv, linux-kernel, liubao918 [-- Attachment #1.1: Type: text/plain, Size: 2978 bytes --] On Tue, Mar 21, 2023 at 04:03:49PM +0100, Torsten Duwe wrote: > On Mon, 13 Mar 2023 11:13:17 +0800 > Li Zhengyu <lizhengyu3@huawei.com> wrote: > > > On Fri, 10 Mar 2023 19:27:03 +0100, Torsten Duwe <duwe@lst.de> wrote: > > > Depending on the toolchain (here: gcc-12, binutils-2.40) the > > > relocation entries for function calls are no longer R_RISCV_CALL, but > > > R_RISCV_CALL_PLT. When trying kexec_load_file on such kernels, it will > > > fail with > > > > > > kexec_image: Unknown rela relocation: 19 > > > kexec_image: Error loading purgatory ret=-8 > > > > > > The binary code at the call site remains the same, so tell > > > arch_kexec_apply_relocations_add() to handle _PLT alike. > > > > R_RISCV_CALL has already been deprecated, and replaced by R_RISCV_CALL_PLT. > > > > See Enum 18-19 in Table 3. Relocation types from > > https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc > > . > > > > It was deprecated in ("Deprecated R_RISCV_CALL, prefer > > R_RISCV_CALL_PLT") > > https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0 > > > > > > > > fixes: 838b3e28488f702 ("Load purgatory in kexec_file") > > > Signed-off-by: Torsten Duwe <duwe@suse.de> > > > Cc: stable@vger.kernel.org > > > > > > --- > > > --- a/arch/riscv/kernel/elf_kexec.c > > > +++ b/arch/riscv/kernel/elf_kexec.c > > > @@ -425,6 +425,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, > > > * sym, instead of searching the whole relsec. > > > */ > > > case R_RISCV_PCREL_HI20: > > > + case R_RISCV_CALL_PLT: > > > case R_RISCV_CALL: > > > *(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) | > > > ENCODE_UJTYPE_IMM(val - addr); > > > > > > . > > > > Palmer, please apply these references to the commit message. > > > > Reviewed-by: Li Zhengyu <lizhengyu3@huawei.com> > > > > Ping? It's not been all that longer than a week & you're in patchwork so you won't be forgotten, but I noticed a complaint when I went looking on patchwork about your fixes tag: Commit: f28b81e30b4b ("riscv: relocate R_RISCV_CALL_PLT in kexec_file") Fixes tag: fixes: 838b3e28488f702 ("Load purgatory in kexec_file") Has these problem(s): - Subject does not match target commit subject Just use git log -1 --format='Fixes: %h ("%s")' The fixes tag should be: Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file") Note the capital F & the missed RISC-V: prefix, checkpatch should have complained about this. Checkpatch also complains that your suse email in the Signoff doesn't match the lst.de email that you used to send the patch (IOW you're missing a From: header that send-email would add). Could you fix those things up please & I suppose you can take the opportunity to make the changes that Li Zhengyu suggested to the commit message itself at the same time. Thanks, Conor. [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] [-- Attachment #2: Type: text/plain, Size: 161 bytes --] _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] riscv: relocate R_RISCV_CALL_PLT in kexec_file 2023-03-21 15:35 ` Conor Dooley @ 2023-07-23 10:27 ` Conor Dooley 0 siblings, 0 replies; 5+ messages in thread From: Conor Dooley @ 2023-07-23 10:27 UTC (permalink / raw) To: Conor Dooley Cc: Torsten Duwe, Palmer Dabbelt, Li Zhengyu, Paul Walmsley, Albert Ou, Li Huafei, Liao Chang, linux-riscv, linux-kernel, liubao918 [-- Attachment #1.1: Type: text/plain, Size: 3366 bytes --] Hey Torsten, On Tue, Mar 21, 2023 at 03:35:38PM +0000, Conor Dooley wrote: > On Tue, Mar 21, 2023 at 04:03:49PM +0100, Torsten Duwe wrote: > > On Mon, 13 Mar 2023 11:13:17 +0800 > > Li Zhengyu <lizhengyu3@huawei.com> wrote: > > > > > On Fri, 10 Mar 2023 19:27:03 +0100, Torsten Duwe <duwe@lst.de> wrote: > > > > Depending on the toolchain (here: gcc-12, binutils-2.40) the > > > > relocation entries for function calls are no longer R_RISCV_CALL, but > > > > R_RISCV_CALL_PLT. When trying kexec_load_file on such kernels, it will > > > > fail with > > > > > > > > kexec_image: Unknown rela relocation: 19 > > > > kexec_image: Error loading purgatory ret=-8 > > > > > > > > The binary code at the call site remains the same, so tell > > > > arch_kexec_apply_relocations_add() to handle _PLT alike. > > > > > > R_RISCV_CALL has already been deprecated, and replaced by R_RISCV_CALL_PLT. > > > > > > See Enum 18-19 in Table 3. Relocation types from > > > https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc > > > . > > > > > > It was deprecated in ("Deprecated R_RISCV_CALL, prefer > > > R_RISCV_CALL_PLT") > > > https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0 > > > > > > > > > > > fixes: 838b3e28488f702 ("Load purgatory in kexec_file") > > > > Signed-off-by: Torsten Duwe <duwe@suse.de> > > > > Cc: stable@vger.kernel.org > > > > > > > > --- > > > > --- a/arch/riscv/kernel/elf_kexec.c > > > > +++ b/arch/riscv/kernel/elf_kexec.c > > > > @@ -425,6 +425,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, > > > > * sym, instead of searching the whole relsec. > > > > */ > > > > case R_RISCV_PCREL_HI20: > > > > + case R_RISCV_CALL_PLT: > > > > case R_RISCV_CALL: > > > > *(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) | > > > > ENCODE_UJTYPE_IMM(val - addr); > > > > > > > > . > > > > > > Palmer, please apply these references to the commit message. > > > > > > Reviewed-by: Li Zhengyu <lizhengyu3@huawei.com> > > > > > > > Ping? > > It's not been all that longer than a week & you're in patchwork so you > won't be forgotten, Turns out it did get forgotten, or more accurately, marked as "Changes Requested". > but I noticed a complaint when I went looking on > patchwork about your fixes tag: > > Commit: f28b81e30b4b ("riscv: relocate R_RISCV_CALL_PLT in kexec_file") > Fixes tag: fixes: 838b3e28488f702 ("Load purgatory in kexec_file") > Has these problem(s): > - Subject does not match target commit subject > Just use > git log -1 --format='Fixes: %h ("%s")' > > The fixes tag should be: > Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file") > > Note the capital F & the missed RISC-V: prefix, checkpatch should have > complained about this. > Checkpatch also complains that your suse email in the Signoff doesn't > match the lst.de email that you used to send the patch (IOW you're > missing a From: header that send-email would add). > > Could you fix those things up please & I suppose you can take the > opportunity to make the changes that Li Zhengyu suggested to the commit > message itself at the same time. Would you mind resending this with the Fixes & Signoff corrections? Thanks, Conor. [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] [-- Attachment #2: Type: text/plain, Size: 161 bytes --] _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-07-23 10:27 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-03-10 18:27 [PATCH] riscv: relocate R_RISCV_CALL_PLT in kexec_file Torsten Duwe 2023-03-13 3:13 ` Li Zhengyu 2023-03-21 15:03 ` Torsten Duwe 2023-03-21 15:35 ` Conor Dooley 2023-07-23 10:27 ` Conor Dooley
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).