add a patch to fix build error

This commit is contained in:
ouuleilei 2023-09-08 10:11:09 +08:00
parent 4dc1555fc9
commit 034249d78b
3 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,56 @@
From 403d6540cd608b2706cfa0cb4713f7e4b490ff45 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 23 Feb 2023 13:15:08 -0800
Subject: [PATCH] RISC-V: Handle R_RISCV_CALL_PLT reloc
GNU assembler starting 2.40 release always generates R_RISCV_CALL_PLT
reloc for call in assembler [1], similarly LLVM does not make
distinction between R_RISCV_CALL_PLT and R_RISCV_CALL [2].
Fixes "grub-mkimage: error: relocation 0x13 is not implemented yet.".
[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=70f35d72ef04cd23771875c1661c9975044a749c
[2] https://reviews.llvm.org/D132530
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
grub-core/kern/riscv/dl.c | 1 +
util/grub-mkimagexx.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/grub-core/kern/riscv/dl.c b/grub-core/kern/riscv/dl.c
index f26b12aaa..896653bb4 100644
--- a/grub-core/kern/riscv/dl.c
+++ b/grub-core/kern/riscv/dl.c
@@ -188,6 +188,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
break;
case R_RISCV_CALL:
+ case R_RISCV_CALL_PLT:
{
grub_uint32_t *abs_place = place;
grub_ssize_t off = sym_addr - (grub_addr_t) place;
diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
index a1927e786..c5fb336e9 100644
--- a/util/grub-mkimagexx.c
+++ b/util/grub-mkimagexx.c
@@ -1294,6 +1294,7 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct section_metadata *smd,
}
break;
case R_RISCV_CALL:
+ case R_RISCV_CALL_PLT:
{
grub_uint32_t hi20, lo12;
@@ -1726,6 +1727,7 @@ translate_relocation_pe (struct translate_context *ctx,
case R_RISCV_BRANCH:
case R_RISCV_JAL:
case R_RISCV_CALL:
+ case R_RISCV_CALL_PLT:
case R_RISCV_PCREL_HI20:
case R_RISCV_PCREL_LO12_I:
case R_RISCV_PCREL_LO12_S:
--
2.39.1

View File

@ -340,3 +340,4 @@ Patch0330: backport-net-dns-Fix-lookup-error-when-no-IPv6-is-returned.patch
Patch0331: backport-util-grub-install-common-Fix-the-key-of.patch Patch0331: backport-util-grub-install-common-Fix-the-key-of.patch
Patch0332: backport-kern-efi-mm-Fix-use-after-free-in-finish-boot-services.patch Patch0332: backport-kern-efi-mm-Fix-use-after-free-in-finish-boot-services.patch
Patch0333: backport-kern-Check-for-NULL-when-closing-devices-and-disks.patch Patch0333: backport-kern-Check-for-NULL-when-closing-devices-and-disks.patch
Patch0334: backport-RISC-V-Handle-R_RISCV_CALL_PLT-reloc.patch

View File

@ -14,7 +14,7 @@
Name: grub2 Name: grub2
Epoch: 1 Epoch: 1
Version: 2.06 Version: 2.06
Release: 35 Release: 36
Summary: Bootloader with support for Linux, Multiboot and more Summary: Bootloader with support for Linux, Multiboot and more
License: GPLv3+ License: GPLv3+
URL: http://www.gnu.org/software/grub/ URL: http://www.gnu.org/software/grub/
@ -440,6 +440,9 @@ fi
%{_datadir}/man/man* %{_datadir}/man/man*
%changelog %changelog
* Fri Sep 1 2023 ouuleilei <wangliu@iscas.ac.cn> - 1:2.06-36
add a patch to fix build error
* Thu Aug 17 2023 zhangqiumiao <zhangqiumiao1@huawei.com> - 1:2.06-35 * Thu Aug 17 2023 zhangqiumiao <zhangqiumiao1@huawei.com> - 1:2.06-35
- Type:bugfix - Type:bugfix
- CVE:NA - CVE:NA