guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: gnu: gcc: Choose float ABI on ARM based on --with-float configure


From: Mark H. Weaver
Subject: 01/01: gnu: gcc: Choose float ABI on ARM based on --with-float configure flag.
Date: Wed, 31 Dec 2014 22:06:44 +0000

mhw pushed a commit to branch wip-armhf
in repository guix.

commit 36744495d4312a145c0516578825e4eef4fc2d12
Author: Mark H Weaver <address@hidden>
Date:   Wed Dec 31 16:26:12 2014 -0500

    gnu: gcc: Choose float ABI on ARM based on --with-float configure flag.
    
    * gnu/packages/patches/gcc-4.7-arm-default-float-abi.patch,
      gnu/packages/patches/gcc-arm-default-float-abi.patch: New files.
    * gnu-system.am (dist_patch_DATA): Add them.
    * gnu/packages/gcc.scm (gcc-4.7, gcc-4.8, gcc-4.9): Add patches.
---
 gnu-system.am                                      |    2 +
 gnu/packages/gcc.scm                               |   12 +++-
 .../patches/gcc-4.7-arm-default-float-abi.patch    |   44 +++++++++++++++
 .../patches/gcc-arm-default-float-abi.patch        |   58 ++++++++++++++++++++
 4 files changed, 113 insertions(+), 3 deletions(-)

diff --git a/gnu-system.am b/gnu-system.am
index 485b4ab..905ea6e 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -355,6 +355,8 @@ dist_patch_DATA =                                           
\
   gnu/packages/patches/flashrom-use-libftdi1.patch             \
   gnu/packages/patches/flex-bison-tests.patch                  \
   gnu/packages/patches/gawk-shell.patch                                \
+  gnu/packages/patches/gcc-4.7-arm-default-float-abi.patch     \
+  gnu/packages/patches/gcc-arm-default-float-abi.patch         \
   gnu/packages/patches/gcc-cross-environment-variables.patch   \
   gnu/packages/patches/gd-mips64-deplibs-fix.patch             \
   gnu/packages/patches/glib-tests-desktop.patch                        \
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 2bc8982..48889f1 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -127,7 +127,9 @@ where the OS part is overloaded to denote a specific 
ABI---into GCC
                                    version "/gcc-" version ".tar.bz2"))
                (sha256
                 (base32
-                 "10k2k71kxgay283ylbbhhs51cl55zn2q38vj5pk4k950qdnirrlj"))))
+                 "10k2k71kxgay283ylbbhhs51cl55zn2q38vj5pk4k950qdnirrlj"))
+               (patches
+                (list (search-patch "gcc-4.7-arm-default-float-abi.patch")))))
       (build-system gnu-build-system)
 
       ;; Separate out the run-time support libraries because all the
@@ -278,7 +280,9 @@ Go.  It also includes runtime support libraries for these 
languages.")
                                  version "/gcc-" version ".tar.bz2"))
              (sha256
               (base32
-               "15c6gwm6dzsaagamxkak5smdkf1rdfbqqjs9jdbrp3lbg4ism02a"))))))
+               "15c6gwm6dzsaagamxkak5smdkf1rdfbqqjs9jdbrp3lbg4ism02a"))
+             (patches
+              (list (search-patch "gcc-arm-default-float-abi.patch")))))))
 
 (define-public gcc-4.9
   (package (inherit gcc-4.7)
@@ -289,7 +293,9 @@ Go.  It also includes runtime support libraries for these 
languages.")
                                  version "/gcc-" version ".tar.bz2"))
              (sha256
               (base32
-               "1pbjp4blk2ycaa6r3jmw4ky5f1s9ji3klbqgv8zs2sl5jn1cj810"))))))
+               "1pbjp4blk2ycaa6r3jmw4ky5f1s9ji3klbqgv8zs2sl5jn1cj810"))
+             (patches
+              (list (search-patch "gcc-arm-default-float-abi.patch")))))))
 
 (define* (custom-gcc gcc name languages #:key (separate-lib-output? #t))
   "Return a custom version of GCC that supports LANGUAGES."
diff --git a/gnu/packages/patches/gcc-4.7-arm-default-float-abi.patch 
b/gnu/packages/patches/gcc-4.7-arm-default-float-abi.patch
new file mode 100644
index 0000000..bcd6635
--- /dev/null
+++ b/gnu/packages/patches/gcc-4.7-arm-default-float-abi.patch
@@ -0,0 +1,44 @@
+Modify GCC on ARM to use the hard-float ABI when --with-float=hard is
+passed to configure.  Based on the 'arm-multilib-defaults' patch in Debian.
+
+--- gcc-4.7.4/gcc/config.gcc.orig      2013-10-02 20:52:23.000000000 -0400
++++ gcc-4.7.4/gcc/config.gcc   2014-12-31 16:58:32.884520095 -0500
+@@ -3097,10 +3097,18 @@
+               esac
+ 
+               case "$with_float" in
+-              "" \
+-              | soft | hard | softfp)
++              "")
+                       # OK
+                       ;;
++              soft)
++                      tm_defines="${tm_defines} TARGET_CONFIGURED_FLOAT_ABI=0"
++                      ;;
++              softfp)
++                      tm_defines="${tm_defines} TARGET_CONFIGURED_FLOAT_ABI=1"
++                      ;;
++              hard)
++                      tm_defines="${tm_defines} TARGET_CONFIGURED_FLOAT_ABI=2"
++                      ;;
+               *)
+                       echo "Unknown floating point type used in 
--with-float=$with_float" 1>&2
+                       exit 1
+--- gcc-4.7.4/gcc/config/arm/linux-eabi.h.orig 2011-11-02 11:03:19.000000000 
-0400
++++ gcc-4.7.4/gcc/config/arm/linux-eabi.h      2014-12-31 16:58:32.888520114 
-0500
+@@ -34,7 +34,14 @@
+ /* We default to a soft-float ABI so that binaries can run on all
+    target hardware.  */
+ #undef  TARGET_DEFAULT_FLOAT_ABI
+-#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
++
++#if TARGET_CONFIGURED_FLOAT_ABI == 2
++# define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
++#elif TARGET_CONFIGURED_FLOAT_ABI == 1
++# define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFTFP
++#else
++# define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
++#endif
+ 
+ /* We default to the "aapcs-linux" ABI so that enums are int-sized by
+    default.  */
diff --git a/gnu/packages/patches/gcc-arm-default-float-abi.patch 
b/gnu/packages/patches/gcc-arm-default-float-abi.patch
new file mode 100644
index 0000000..3a2b24f
--- /dev/null
+++ b/gnu/packages/patches/gcc-arm-default-float-abi.patch
@@ -0,0 +1,58 @@
+Modify GCC on ARM to use the hard-float ABI when --with-float=hard is
+passed to configure.  Based on the 'arm-multilib-defaults' patch in Debian.
+
+--- gcc-4.8.4/gcc/config.gcc.~1~       2014-11-10 06:35:27.000000000 -0500
++++ gcc-4.8.4/gcc/config.gcc   2014-12-31 16:00:23.955992259 -0500
+@@ -3270,10 +3270,18 @@
+               esac
+ 
+               case "$with_float" in
+-              "" \
+-              | soft | hard | softfp)
++              "")
+                       # OK
+                       ;;
++              soft)
++                      tm_defines="${tm_defines} TARGET_CONFIGURED_FLOAT_ABI=0"
++                      ;;
++              softfp)
++                      tm_defines="${tm_defines} TARGET_CONFIGURED_FLOAT_ABI=1"
++                      ;;
++              hard)
++                      tm_defines="${tm_defines} TARGET_CONFIGURED_FLOAT_ABI=2"
++                      ;;
+               *)
+                       echo "Unknown floating point type used in 
--with-float=$with_float" 1>&2
+                       exit 1
+--- gcc-4.8.4/gcc/config/arm/linux-eabi.h.~1~  2013-01-10 15:38:27.000000000 
-0500
++++ gcc-4.8.4/gcc/config/arm/linux-eabi.h      2014-12-31 16:02:45.408693685 
-0500
+@@ -34,7 +34,14 @@
+    target hardware.  If you override this to use the hard-float ABI then
+    change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well.  */
+ #undef  TARGET_DEFAULT_FLOAT_ABI
+-#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
++
++#if TARGET_CONFIGURED_FLOAT_ABI == 2
++# define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
++#elif TARGET_CONFIGURED_FLOAT_ABI == 1
++# define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFTFP
++#else
++# define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
++#endif
+ 
+ /* We default to the "aapcs-linux" ABI so that enums are int-sized by
+    default.  */
+@@ -70,7 +77,12 @@
+ #undef  GLIBC_DYNAMIC_LINKER
+ #define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
+ #define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
+-#define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
++
++#if TARGET_CONFIGURED_FLOAT_ABI == 2
++# define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_HARD_FLOAT
++#else
++# define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
++#endif
+ 
+ #define GLIBC_DYNAMIC_LINKER \
+    "%{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \



reply via email to

[Prev in Thread] Current Thread [Next in Thread]