1From b47029e8e582d17c6874d2622fe1a5b834377dbb Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 26 Mar 2021 11:59:43 -0700
4Subject: [PATCH] RISC-V: Restore the typcast to 64bit type
5
6this makes the type promotions clear and explicit
7It was already typecasted to long but was accidentally dropped in [1]
8which stated to cause failures on riscv32 as reported in [2]
9
10[1] https://git.savannah.gnu.org/cgit/grub.git/commit/?id=2bf40e9e5be9808b17852e688eead87acff14420
11[2] https://savannah.gnu.org/bugs/index.php?60283
12
13Upstream-Status: Submitted
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15Cc: Andreas Schwab <schwab@suse.de>
16Cc: Daniel Kiper <daniel.kiper@oracle.com>
17Cc: Chester Lin <clin@suse.com>
18Cc: Nikita Ermakov <arei@altlinux.org>
19Cc: Alistair Francis <alistair.francis@wdc.com>
20
21---
22 util/grub-mkimagexx.c | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
26index e50b295..2f09255 100644
27--- a/util/grub-mkimagexx.c
28+++ b/util/grub-mkimagexx.c
29@@ -1310,7 +1310,7 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct section_metadata *smd,
30 		  */
31
32 		 sym_addr += addend;
33-		 off = sym_addr - target_section_addr - offset - image_target->vaddr_offset;
34+		 off = (grub_int64_t)sym_addr - target_section_addr - offset - image_target->vaddr_offset;
35
36 		 switch (ELF_R_TYPE (info))
37 		   {
38