Use -fPIC with arm64 with clang.

Currently it doesn't work either way but with -fPIC it should work once
clang bug is fixed.
This commit is contained in:
Vladimir Serbinenko 2017-02-02 01:24:11 +01:00
parent dac87d6032
commit 393cc59195

View file

@ -1229,9 +1229,12 @@ grub_CHECK_PIC
# and reload $gp in every function. # and reload $gp in every function.
# GCC implements it using symbol __gnu_local_gp in non-PIC as well. # GCC implements it using symbol __gnu_local_gp in non-PIC as well.
# However with clang we need PIC for this reloading to happen. # 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 # Since default varies across dictributions use either -fPIC or -fno-PIC
# explicitly. # 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" TARGET_CFLAGS="$TARGET_CFLAGS -fPIC"
elif [ x"$pic_possible" = xyes ]; then elif [ x"$pic_possible" = xyes ]; then
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC" TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"