From: Sandra Loosemore Date: Wed, 6 May 2015 16:01:05 +0000 (-0400) Subject: unknown-elf.h (STARTFILE_SPEC): Add conditional linking of crtfastmath.o. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5a0ff57c48cbaeedfac667d5e808baca8dbcb83c;p=gcc.git unknown-elf.h (STARTFILE_SPEC): Add conditional linking of crtfastmath.o. 2015-05-06 Sandra Loosemore Chris Jones Joshua Conner 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 Co-Authored-By: Joshua Conner From-SVN: r222857 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3b267c8d3a3..a3ccaf63f43 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-05-06 Sandra Loosemore + Chris Jones + Joshua Conner + + * 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 * config/rs6000/rs6000.md (cstore4_signed_imm): New expander. diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h index e9d65dcdec4..2cf3ca77170 100644 --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h @@ -107,6 +107,7 @@ #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 diff --git a/gcc/config/arm/unknown-elf.h b/gcc/config/arm/unknown-elf.h index 2e5ab7edf48..d1d4f7a1c66 100644 --- a/gcc/config/arm/unknown-elf.h +++ b/gcc/config/arm/unknown-elf.h @@ -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" diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 39c9433d644..a3f3962a8d3 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,12 @@ +2015-05-06 Sandra Loosemore + Chris Jones + Joshua Conner + + * 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 * Makefile.in (real_host_noncanonical): New variable. diff --git a/libgcc/config.host b/libgcc/config.host index ac39f422059..d558c383631 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -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 index 00000000000..9573514961e --- /dev/null +++ b/libgcc/config/arm/crtfastmath.c @@ -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 + * . + */ + +/* 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__ */