arm64 softfloat

Message ID 20150602120917.GI8790@bivouac.eciton.net
State New
Headers show

Commit Message

Leif Lindholm June 2, 2015, 12:09 p.m.
Hi,

As I mentioned yeaterday, I ran into some toolchain issues yesterday.
When attempting my first build on Fedora 22, which uses GCC5.1, the
build fails. First with an internal compiler error, and with a
workaround for that, it simply refuses to go past.

Basically, AArch64 (arm64) does not define a soft-float ABI. Recent
versions of GCC now (presumably correctly) bails out when encountering
floating-point if +nofp has been specified in -march flags. Also, the
UEFI specification mandates that for aarch64 the cpu is configured
such that floating-point exceptions are not generated - so it should
be safe to generate floating-point instructions.

So would it be possible to do something like the below?:

From a1821c9222bab447b2d3faccf69e518c65e0f638 Mon Sep 17 00:00:00 2001
From: Leif Lindholm <leif.lindholm@linaro.org>
Date: Mon, 1 Jun 2015 23:58:44 +0100
Subject: [PATCH] arm64: do not force-enable soft-float

AArch64 (arm64) does not define a soft-float ABI. GCC5.1 now (presumably
correctly) bails out when encountering floating-point if +nofp has been
specified in -march flags. Also, the UEFI specification mandates that
the cpu is configured such that floating-point exceptions are not
generated - so it should be safe to generate floating-point instructions.

So drop +nofp and +nosimd from configure.ac for arm64.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
 configure.ac | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

Patch hide | download patch | download mbox

diff --git a/configure.ac b/configure.ac
index 891c14f..0a6d2e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -686,9 +686,8 @@  if test x"$platform" != xemu ; then
   AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [
     grub_cv_target_cc_soft_float=no
     if test "x$target_cpu" = xarm64; then
-       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"], [])
+       CFLAGS="$TARGET_CFLAGS -Werror"
+       grub_cv_target_cc_soft_float=""
     fi
     if test "x$target_cpu" = xia64; then
        CFLAGS="$TARGET_CFLAGS -mno-inline-float-divide -mno-inline-sqrt -Werror"
@@ -720,15 +719,7 @@  if test x"$platform" != xemu ; then
       TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_soft_float"
       ;;
   esac
-  case x"$grub_cv_target_cc_soft_float" in
-    x"-march=armv8-a+nofp+nosimd")
-      # +nosimd disables also the cache opcodes that we need in asm.
-      TARGET_CCASFLAGS="$TARGET_CCASFLAGS -march=armv8-a+nofp"
-      ;;
-    *)
-      TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_soft_float"
-      ;;
-  esac
+  TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_soft_float"
 
 fi