diff mbox series

gnu-efi: Fix build break on riscv64

Message ID 20230730213828.3420458-1-raj.khem@gmail.com
State Accepted, archived
Commit 41b54ac83c756897f444b8fe651953e4feaa4571
Headers show
Series gnu-efi: Fix build break on riscv64 | expand

Commit Message

Khem Raj July 30, 2023, 9:38 p.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...0001-riscv64-adjust-type-definitions.patch | 34 +++++++++++++++++++
 .../0001-riscv64-ignore-unknown-relocs.patch  | 32 +++++++++++++++++
 meta/recipes-bsp/gnu-efi/gnu-efi_3.0.17.bb    |  2 ++
 3 files changed, 68 insertions(+)
 create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi/0001-riscv64-adjust-type-definitions.patch
 create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi/0001-riscv64-ignore-unknown-relocs.patch
diff mbox series

Patch

diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi/0001-riscv64-adjust-type-definitions.patch b/meta/recipes-bsp/gnu-efi/gnu-efi/0001-riscv64-adjust-type-definitions.patch
new file mode 100644
index 00000000000..3475606264e
--- /dev/null
+++ b/meta/recipes-bsp/gnu-efi/gnu-efi/0001-riscv64-adjust-type-definitions.patch
@@ -0,0 +1,34 @@ 
+From 1de509497826faa0ad84b82f5e2c3d21ee613459 Mon Sep 17 00:00:00 2001
+From: Moody Liu <mooodyhunter@outlook.com>
+Date: Sat, 13 May 2023 17:39:16 +0100
+Subject: [PATCH] riscv64: adjust type definitions
+
+CHAR8 needs to be defined while BOOLEAN should be removed
+here to prevent typedef conflicts
+
+Upstream-Status: Backport [https://sourceforge.net/p/gnu-efi/code/ci/1de509497826faa0ad84b82f5e2c3d21ee613459/]
+Signed-off-by: Moody Liu <mooodyhunter@outlook.com>
+---
+ inc/riscv64/efibind.h | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/inc/riscv64/efibind.h b/inc/riscv64/efibind.h
+index 4fdf81d..d8b4f39 100644
+--- a/inc/riscv64/efibind.h
++++ b/inc/riscv64/efibind.h
+@@ -32,11 +32,9 @@ typedef uint16_t                UINT16;
+ typedef int16_t                 INT16;
+ typedef uint8_t                 UINT8;
+ typedef int8_t                  INT8;
++typedef char                    CHAR8;
+ typedef wchar_t                 CHAR16;
+ #define WCHAR                   CHAR16
+-#ifndef BOOLEAN
+-typedef uint8_t                 BOOLEAN;
+-#endif
+ #undef VOID
+ typedef void                    VOID;
+ typedef int64_t                 INTN;
+-- 
+2.41.0
+
diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi/0001-riscv64-ignore-unknown-relocs.patch b/meta/recipes-bsp/gnu-efi/gnu-efi/0001-riscv64-ignore-unknown-relocs.patch
new file mode 100644
index 00000000000..5b3c152c5e0
--- /dev/null
+++ b/meta/recipes-bsp/gnu-efi/gnu-efi/0001-riscv64-ignore-unknown-relocs.patch
@@ -0,0 +1,32 @@ 
+From 708f66acfec9a86f237726d45095cbd380fd83ca Mon Sep 17 00:00:00 2001
+From: Callum Farmer <gmbr3@opensuse.org>
+Date: Wed, 21 Jun 2023 11:32:28 +0100
+Subject: [PATCH] riscv64: ignore unknown relocs
+
+Sometimes ld emits relocs such as R_RISCV_64 for unwind symbols
+these don't need to be handled yet so just can be skipped otherwise
+the binary will never load
+
+Upstream-Status: Backport [https://sourceforge.net/p/gnu-efi/code/ci/708f66acfec9a86f237726d45095cbd380fd83ca/]
+Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
+---
+ gnuefi/reloc_riscv64.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/gnuefi/reloc_riscv64.c b/gnuefi/reloc_riscv64.c
+index 0b02d83..e429602 100644
+--- a/gnuefi/reloc_riscv64.c
++++ b/gnuefi/reloc_riscv64.c
+@@ -81,8 +81,7 @@ EFI_STATUS EFIAPI _relocate(long ldbase, Elf_Dyn *dyn)
+ 			*addr = ldbase + rel->r_addend;
+ 			break;
+ 		default:
+-			/* Panic */
+-			while (1) ;
++				break;
+ 		}
+ 		rel = (Elf_Rela *)((char *)rel + relent);
+ 		relsz -= relent;
+-- 
+2.41.0
+
diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi_3.0.17.bb b/meta/recipes-bsp/gnu-efi/gnu-efi_3.0.17.bb
index 547c469d19f..d37d638e097 100644
--- a/meta/recipes-bsp/gnu-efi/gnu-efi_3.0.17.bb
+++ b/meta/recipes-bsp/gnu-efi/gnu-efi_3.0.17.bb
@@ -15,6 +15,8 @@  LIC_FILES_CHKSUM = "file://gnuefi/crt0-efi-arm.S;beginline=4;endline=16;md5=e582
 SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/files/${BP}.tar.bz2 \
            file://parallel-make-archives.patch \
            file://gnu-efi-3.0.9-fix-clang-build.patch \
+           file://0001-riscv64-adjust-type-definitions.patch \
+           file://0001-riscv64-ignore-unknown-relocs.patch \
            "
 
 SRC_URI[sha256sum] = "7807e903349343a7a142ebb934703a2872235e89688cf586c032b0a1087bcaf4"