Use -fPIC with arm64 with clang.
authorVladimir Serbinenko <phcoder@gmail.com>
Thu, 2 Feb 2017 00:24:11 +0000 (01:24 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Thu, 2 Feb 2017 00:24:11 +0000 (01:24 +0100)
Currently it doesn't work either way but with -fPIC it should work once
clang bug is fixed.

configure.ac

index 8f52754..4f7765c 100644 (file)
@@ -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"