archive mirror
 help / color / mirror / Atom feed
From: Torsten Duwe <>
To: Li Zhengyu <>,
	Paul Walmsley <>,
	Conor Dooley <>,
	Palmer Dabbelt <>
Cc: Albert Ou <>,
	Li Huafei <>,
	Liao Chang <>,,
Subject: [PATCH] riscv: relocate R_RISCV_CALL_PLT in kexec_file
Date: Fri, 10 Mar 2023 19:27:26 +0100	[thread overview]
Message-ID: <> (raw)

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 <>

--- 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:
 			*(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) |
 				 ENCODE_UJTYPE_IMM(val - addr);

             reply	other threads:[~2023-03-10 18:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10 18:27 Torsten Duwe [this message]
2023-03-13  3:13 ` [PATCH] riscv: relocate R_RISCV_CALL_PLT in kexec_file Li Zhengyu
2023-03-21 15:03   ` Torsten Duwe
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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).