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
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2103864

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

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


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to