From 393cc59195901ec58509973b8152fbfeb84d04bd Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Thu, 2 Feb 2017 01:24:11 +0100 Subject: [PATCH] Use -fPIC with arm64 with clang. Currently it doesn't work either way but with -fPIC it should work once clang bug is fixed. --- configure.ac | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8f527544b..4f7765c2d 100644 --- a/configure.ac +++ b/configure.ac @@ -1229,9 +1229,12 @@ grub_CHECK_PIC # and reload $gp in every function. # GCC implements it using symbol __gnu_local_gp in non-PIC as well. # However with clang we need PIC for this reloading to happen. +# With arm64 we need relocations that are in some way representable in +# PE as we need to support arm64-efi. Without -fPIC clang generates +# movk's which aren't representable. # Since default varies across dictributions use either -fPIC or -fno-PIC # explicitly. -if ( test x$target_cpu = xmips || test x$target_cpu = xmipsel ) && test "x$grub_cv_cc_target_clang" = xyes ; then +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 TARGET_CFLAGS="$TARGET_CFLAGS -fPIC" elif [ x"$pic_possible" = xyes ]; then TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"