Skip to content

Commit 4ac041b

Browse files
andreabolognanilsandov1
authored andcommitted
loader/efi: Fix RISC-V build
Some struct definitions are currently limited to 32-bit and 64-bit Arm architectures, but they actually apply to other architectures as well, specifically 32-bit and 64-bit RISC-V respectively. Update the preprocessor checks guarding their definition, and change their names to make them more accurate by replacing the word "arm" with the word "efi". Signed-off-by: Andrea Bolognani <[email protected]>
1 parent 9287e38 commit 4ac041b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

grub-core/loader/efi/linux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ parse_pe_header (void *kernel, grub_uint64_t *total_size,
684684
grub_uint32_t *alignment, grub_uint32_t *code_size)
685685
{
686686
struct linux_arch_kernel_header *lh = kernel;
687-
struct grub_armxx_linux_pe_header *pe;
687+
struct grub_efixx_linux_pe_header *pe;
688688
grub_uint16_t i;
689689
struct grub_pe32_section_table *sections;
690690

include/grub/efi/efi.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,28 @@ struct linux_arch_kernel_header {
3636
struct grub_pe_image_header pe_image_header;
3737
};
3838

39-
struct grub_arm_linux_pe_header
39+
struct grub_efi32_linux_pe_header
4040
{
4141
grub_uint32_t magic;
4242
struct grub_pe32_coff_header coff;
4343
struct grub_pe32_optional_header opt;
4444
};
4545

46-
struct grub_arm64_linux_pe_header
46+
struct grub_efi64_linux_pe_header
4747
{
4848
grub_uint32_t magic;
4949
struct grub_pe32_coff_header coff;
5050
struct grub_pe64_optional_header opt;
5151
};
5252

53-
#if defined(__arm__)
53+
#if defined(__arm__) || (defined(__riscv) && (__riscv_xlen == 32))
5454
# define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE32_MAGIC
55-
# define grub_armxx_linux_pe_header grub_arm_linux_pe_header
55+
# define grub_efixx_linux_pe_header grub_efi32_linux_pe_header
5656
#endif
5757

58-
#if defined(__aarch64__)
58+
#if defined(__aarch64__) || (defined(__riscv) && (__riscv_xlen == 64))
5959
# define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE64_MAGIC
60-
# define grub_armxx_linux_pe_header grub_arm64_linux_pe_header
60+
# define grub_efixx_linux_pe_header grub_efi64_linux_pe_header
6161
#endif
6262

6363
#define GRUB_EFI_GRUB_VARIABLE_GUID \

0 commit comments

Comments
 (0)