[Bug 2103864] Re: grub-efi-riscv64-bin 2.12-5ubuntu9 fails with "relocation overflow"

Heinrich Schuchardt 2103864 at bugs.launchpad.net
Sat Mar 22 22:24:30 UTC 2025


Upstream GRUB on RISC-V is compiled with -mcmodel=medany -fno-PIE:

A first configuration test has as result: "cc1: sorry, unimplemented: code model 'large' with '-fPIC'".
Later checking whether `riscv64-linux-gnu-gcc' has `-fPIC' as default results in no.

medany is meant for executables up to 2 GiB. This is why HI20
relocations can be used.

Configure.ac on arm64 selects -fPIC as build argument. I wonder if for
RISC-V should use the same.

1393 # Position independent executable.
1394 grub_CHECK_PIC
1395 [# On most platforms we don't want PIC as it only makes relocations harder
1396 # and code less efficient. On mips we want to have one got table per module
1397 # and reload $gp in every function.
1398 # GCC implements it using symbol __gnu_local_gp in non-PIC as well.
1399 # However with clang we need PIC for this reloading to happen.
1400 # With arm64 we need relocations that are in some way representable in
1401 # PE as we need to support arm64-efi. Without -fPIC clang generates
1402 # movk's which aren't representable.
1403 # Since default varies across dictributions use either -fPIC or -fno-PIC
1404 # explicitly.
1405 if ( test x$target_cpu = xmips || test x$target_cpu = xmipsel || test x$target_cpu = xarm64 ) && test "x$grub_cv_cc_target_clang" = xyes ; then
1406    TARGET_CFLAGS="$TARGET_CFLAGS -fPIC"
1407 elif [ x"$pic_possible" = xyes ]; then
1408    TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
1409 fi]

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub2 in Ubuntu.
https://bugs.launchpad.net/bugs/2103864

Title:
  grub-efi-riscv64-bin 2.12-5ubuntu9 fails with "relocation overflow"

Status in grub2 package in Ubuntu:
  In Progress

Bug description:
  I have a virtual machine with 48 GiB RAM which booted fine before the
  package grub-efi-riscv64 was update to 2.12-5ubuntu9 on 2025-03-21.

  Rebooting the machine fails with "relocation overflow"

  RISC-V EDK2 firmware version 2024.11-5
  Press ESCAPE within 5 seconds for boot options relocation overflow
  Aborted. Press any key to exit.

  When I change the RAM size to 4 GiB booting works fine.

  This bug is release critical for 25.04.

  Best regards

  Heinrich
  ---
  ProblemType: Bug
  ApportVersion: 2.32.0-0ubuntu2
  Architecture: riscv64
  CasperMD5json:
   {
     "result": "skip"
   }
  DistroRelease: Ubuntu 25.04
  InstallationDate: Installed on 2025-03-17 (5 days ago)
  InstallationMedia: Ubuntu-Server 25.04 "Plucky Puffin" - Daily riscv64 (20250316)
  Package: grub2 (not installed)
  ProcVersionSignature: Ubuntu 6.14.0-9.9.1-generic 6.14.0-rc6
  Tags: plucky
  Uname: Linux 6.14.0-9-generic riscv64
  UpgradeStatus: No upgrade log present (probably fresh install)
  UserGroups: N/A
  _MarkForUpload: True

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/2103864/+subscriptions




More information about the foundations-bugs mailing list