unknown-elf.h (STARTFILE_SPEC): Add conditional linking of crtfastmath.o.
authorSandra Loosemore <sandra@codesourcery.com>
Wed, 6 May 2015 16:01:05 +0000 (12:01 -0400)
committerSandra Loosemore <sandra@gcc.gnu.org>
Wed, 6 May 2015 16:01:05 +0000 (12:01 -0400)
2015-05-06  Sandra Loosemore  <sandra@codesourcery.com>
    Chris Jones  <chrisj@nvidia.com>
    Joshua Conner  <jconner@nvidia.com>

gcc/
* config/arm/unknown-elf.h (STARTFILE_SPEC): Add conditional
linking of crtfastmath.o.
* config/arm/linux-eabi.h (STARTFILE_SPEC): Likewise.

libgcc/
* config.host (arm*-*-linux*): Add support for crtfastmath.o.
(arm*-*-uclinux*): Likewise.
(arm*-*-eabi* | arm*-*-rtems*): Likewise.
* config/arm/crtfastmath.c: New file.

Co-Authored-By: Chris Jones <chrisj@nvidia.com>
Co-Authored-By: Joshua Conner <jconner@nvidia.com>
From-SVN: r222857

gcc/ChangeLog
gcc/config/arm/linux-eabi.h
gcc/config/arm/unknown-elf.h
libgcc/ChangeLog
libgcc/config.host
libgcc/config/arm/crtfastmath.c [new file with mode: 0644]

index 3b267c8d3a390034140b3196c396b800de91ca34..a3ccaf63f43e0a53a7525e01a84a7b4cc979f907 100644 (file)
@@ -1,3 +1,11 @@
+2015-05-06  Sandra Loosemore  <sandra@codesourcery.com>
+           Chris Jones  <chrisj@nvidia.com>
+           Joshua Conner  <jconner@nvidia.com>
+
+       * config/arm/unknown-elf.h (STARTFILE_SPEC): Add conditional
+       linking of crtfastmath.o.
+       * config/arm/linux-eabi.h (STARTFILE_SPEC): Likewise.
+
 2015-05-06  Segher Boessenkool  <segher@kernel.crashing.org>
 
        * config/rs6000/rs6000.md (cstore<mode>4_signed_imm): New expander.
index e9d65dcdec4e2d2f1189595d5d03e57e72d55f25..2cf3ca77170964918355962c652be7a863361adb 100644 (file)
 
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} "    \
   LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
 
 /* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
index 2e5ab7edf48a80ee4ec2eac99700e82f45dfa2aa..d1d4f7a1c66172d68581c828f9355872803d5179 100644 (file)
@@ -32,7 +32,9 @@
 #define UNKNOWN_ELF_STARTFILE_SPEC     " crti%O%s crtbegin%O%s crt0%O%s"
 
 #undef  STARTFILE_SPEC
-#define STARTFILE_SPEC UNKNOWN_ELF_STARTFILE_SPEC
+#define STARTFILE_SPEC \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} "    \
+  UNKNOWN_ELF_STARTFILE_SPEC
 
 #define UNKNOWN_ELF_ENDFILE_SPEC       "crtend%O%s crtn%O%s"
 
index 39c9433d6443cdd04594cf8abb9aa6157e55a37f..a3f3962a8d3c9b6a0722e0fbdd5eecd780c153c3 100644 (file)
@@ -1,3 +1,12 @@
+2015-05-06  Sandra Loosemore  <sandra@codesourcery.com>
+           Chris Jones  <chrisj@nvidia.com>
+           Joshua Conner  <jconner@nvidia.com>
+
+       * config.host (arm*-*-linux*): Add support for crtfastmath.o.
+       (arm*-*-uclinux*): Likewise.
+       (arm*-*-eabi* | arm*-*-rtems*): Likewise.
+       * config/arm/crtfastmath.c: New file.
+
 2014-04-29  Bernd Schmidt  <bernds@codesourcery.com>
 
        * Makefile.in (real_host_noncanonical): New variable.
index ac39f422059f2e41cb1c159380aaf044f43b6821..d558c383631db089c1aa0c6a7cfcdfdb25d1bf91 100644 (file)
@@ -377,14 +377,15 @@ arm*-*-netbsdelf*)
        tmake_file="$tmake_file arm/t-arm arm/t-netbsd t-slibgcc-gld-nover"
        ;;
 arm*-*-linux*)                 # ARM GNU/Linux with ELF
-       tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix"
+       tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix t-crtfm"
        tmake_file="${tmake_file} arm/t-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc"
        tm_file="$tm_file arm/bpabi-lib.h"
        unwind_header=config/arm/unwind-arm.h
        tmake_file="$tmake_file t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
+       extra_parts="$extra_parts crtfastmath.o"
        ;;
 arm*-*-uclinux*)               # ARM ucLinux
-       tmake_file="${tmake_file} t-fixedpoint-gnu-prefix"
+       tmake_file="${tmake_file} t-fixedpoint-gnu-prefix t-crtfm"
        tmake_file="$tmake_file arm/t-arm arm/t-elf t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
        tmake_file="${tmake_file} arm/t-bpabi"
        tm_file="$tm_file arm/bpabi-lib.h"
@@ -396,7 +397,7 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*)
        tm_file="$tm_file arm/bpabi-lib.h"
        case ${host} in
        arm*-*-eabi* | arm*-*-rtems*)
-         tmake_file="${tmake_file} arm/t-bpabi"
+         tmake_file="${tmake_file} arm/t-bpabi t-crtfm"
          extra_parts="crtbegin.o crtend.o crti.o crtn.o"
          ;;
        arm*-*-symbianelf*)
diff --git a/libgcc/config/arm/crtfastmath.c b/libgcc/config/arm/crtfastmath.c
new file mode 100644 (file)
index 0000000..9573514
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2014 Free Software Foundation, Inc.
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 3, or (at your option) any
+ * later version.
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * Under Section 7 of GPL version 3, you are granted additional
+ * permissions described in the GCC Runtime Library Exception, version
+ * 3.1, as published by the Free Software Foundation.
+ *
+ * You should have received a copy of the GNU General Public License and
+ * a copy of the GCC Runtime Library Exception along with this program;
+ * see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/* Enable flush-to-zero support for -ffast-math on VFP targets.  */
+#ifndef __SOFTFP__
+
+#define FPSCR_FZ               (1 << 24)
+
+static void __attribute__((constructor))
+__arm_set_fast_math (void)
+{
+  unsigned int fpscr_save;
+
+  /* Set the FZ (flush-to-zero) bit in FPSCR.  */
+  __asm__("vmrs %0, fpscr" : "=r" (fpscr_save));
+  fpscr_save |= FPSCR_FZ;
+  __asm__("vmsr fpscr, %0" : : "r" (fpscr_save));
+}
+
+#endif /* __SOFTFP__  */