#1140751 trixie-pu: package grub2/2.12-9+deb13u3

#1140751#5
Date:
2026-06-25 17:42:11 UTC
From:
To:
[ Reason ]
When `cmodel=large` is not used, GRUB2 uses R_RISCV_CALL/R_RISCV_CALL_PLT
for jumps, which are limited to a ±2 GiB range,however, this is
insufficient for (monolithic)grub.efi.
The solution for GRUB is to use `mcmodel=large`.
On RISC-V, GCC does not allow the simultaneous use of `-fPIE`
and `-mcmodel=large`, issuing an error indicating that this
combination is unimplemented.
- cc1: sorry, unimplemented: code model ‘large’ with ‘-fPIC’
This causes `cmodel=large` to stop working if PIE is detected first.
In addition to the bug described in 1140542,
GRUB must also be prevented from generating `R_RISCV_ALIGN` relocations,
as GRUB cannot ignore them.

[ Impact ]
This issue causes a "relocation overflow" GRUB error when
booting Debian Trixie using EDK2/uboot.
Affected model:
SiFive Premier P550 (uboot efi boot grub)
Milkv Pioneer/Sophgo SG2042 EVB (EDK2 boot grub)
Sophgo SG2044 (EDK2 boot grub)
Spacmit V100 (EDK2 boot grub)

[ Tests ]
I have tested these two patches and verified them on
Milkv Pioneer/Sophgo SG2042 EVB/Sophgo SG2044/SiFive Premier P550
machines.

[ Risks ]
I think the risk is small; both of these patches are adjusting
the compilation options for riscv64.
These changes are already included in GRUB 2.14.

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable

[ Changes ]
* Non-maintainer upload.
* Apply patch from upstream to fix relocation overflow crash on riscv64
  in grub.efi (Closes: #1140542)
  - configure-Add-mno-relax-on-riscv
    from 8fef533cf69547576f522b0e563c9c6fee635ece
  - configure-Defer-check-for-mcmodel-large-until-PIC-PI
    form 1aa0dd0c04a7e66d127915c54d7d7f1de5974d4f