Author: spacemit
Date: Thu Dec 5 10:38:09 2024 +0800
relocation-overflow: fix boot fail while run it from UEFI with multi-range memory layout
patch source:
https://lf-rise.atlassian.net/wiki/spaces/HOME/pages/8586141/DI_01_01+GRUB+-+Relocation+overflow+on+RISC-V+with+multi-range+memory+layout
a relocation problem happened in grub_arch_dl_relocate_symbols() of
grub-core/kern/riscv/dl.c:
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;
grub_uint32_t hi20, lo12;
if (off != (grub_int32_t) off)
return grub_error (GRUB_ERR_BAD_MODULE, "relocation
overflow");
It requires `off' in the range of int32, but it's not enforced since the
>4GB memory can be used.
This patch MAY be repaced in the future.
Change-Id: Ie9bedb15ca05071c908f3e0ace2da19edcba976b```