From: Torsten Duwe <duwe@lst.de>
To: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Li Zhengyu <lizhengyu3@huawei.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Conor Dooley <conor.dooley@microchip.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Li Huafei <lihuafei1@huawei.com>,
"Liao Chang" <liaochang1@huawei.com>,
<linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
<liubao918@huawei.com>
Subject: Re: [PATCH] riscv: relocate R_RISCV_CALL_PLT in kexec_file
Date: Tue, 21 Mar 2023 16:03:49 +0100 [thread overview]
Message-ID: <20230321160349.3b3a46df@blackhole.lan> (raw)
In-Reply-To: <e02fdfce-4574-8e7e-ec96-8e8eaa4067bc@huawei.com>
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?
next prev parent reply other threads:[~2023-03-21 15:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2023-03-21 15:35 ` Conor Dooley
2023-07-23 10:27 ` Conor Dooley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230321160349.3b3a46df@blackhole.lan \
--to=duwe@lst.de \
--cc=aou@eecs.berkeley.edu \
--cc=conor.dooley@microchip.com \
--cc=liaochang1@huawei.com \
--cc=lihuafei1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=liubao918@huawei.com \
--cc=lizhengyu3@huawei.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox