Discover which option provides soft-float on configure stage.

Deals with clang needing other arguments to stop issuing floating
instructions than gcc.
This commit is contained in:
Vladimir Serbinenko 2015-02-21 23:46:47 +01:00
parent da9f30b455
commit ebe316e4df

View file

@ -682,11 +682,39 @@ fi
# that floats are a good fit to run instead of what's written in the code. # that floats are a good fit to run instead of what's written in the code.
# Given that floating point unit is disabled (if present to begin with) # Given that floating point unit is disabled (if present to begin with)
# when GRUB is running which may result in various hard crashes. # when GRUB is running which may result in various hard crashes.
if test "x$target_cpu" = xarm64; then if test x"$platform" != xemu ; then
TARGET_CFLAGS="$TARGET_CFLAGS -march=armv8-a+nofp+nosimd" AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [
else grub_cv_target_cc_soft_float=no
TARGET_CFLAGS="$TARGET_CFLAGS -msoft-float" if test "x$target_cpu" = xarm64; then
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -msoft-float" CFLAGS="$TARGET_CFLAGS -march=armv8-a+nofp+nosimd -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_target_cc_soft_float="-march=armv8-a+nofp+nosimd"], [])
fi
for cand in "-Xclang -msoft-float -Xclang -no-implicit-float" \
"-Xclang -msoft-float" "-msoft-float"; do
if test x"$grub_cv_target_cc_soft_float" != xno ; then
break
fi
CFLAGS="$TARGET_CFLAGS $cand -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_target_cc_soft_float="$cand"], [])
done
])
if test x"$grub_cv_target_cc_soft_float" = xno ; then
AC_MSG_ERROR([could not force soft-float])
fi
case x"$grub_cv_target_cc_soft_float" in
x"-Xclang"*)
# A trick so that clang doesn't see it on link stаge
TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_soft_float"
;;
*)
TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_soft_float"
;;
esac
TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_soft_float"
fi fi
# By default, GCC 4.4 generates .eh_frame sections containing unwind # By default, GCC 4.4 generates .eh_frame sections containing unwind