Hi, -Ofast is intended to be -O3 plus -ffast-math. For the compiler proper this works, but under -ffast-math we add crtfastmath.o (or some equivalent) to the link command line on some targets. As usual for our specs this uses matching on command line arguments, hence we'll explicitely have to add Ofast.
All these targets use the same idiom, so I hope it's okay if I'm testing only x86_64-linux (regstrapping in progress there). CCed the respective target maintainers. I wouldn't have anything against a global reviewer just acking the whole thing :) Ciao, Michael. * config/alpha/elf.h (ENDFILE_SPEC): Add Ofast. * config/alpha/osf5.h (ENDFILE_SPEC): Add Ofast. * config/alpha/netbsd.h (ENDFILE_SPEC): Add Ofast. * config/sparc/linux.h (ENDFILE_SPEC): Add Ofast. * config/sparc/sp64-elf.h (ENDFILE_SPEC): Add Ofast. * config/sparc/sp-elf.h (ENDFILE_SPEC): Add Ofast. * config/sparc/linux64.h (ENDFILE_SPEC): Add Ofast. * config/sparc/freebsd.h (ENDFILE_SPEC): Add Ofast. * config/sparc/sol2.h (ENDFILE_SPEC): Add Ofast. * config/i386/cygwin.h (ENDFILE_SPEC): Add Ofast. * config/i386/gnu-user.h (ENDFILE_SPEC): Add Ofast. * config/i386/gnu-user64.h (ENDFILE_SPEC): Add Ofast. * config/i386/darwin.h (ENDFILE_SPEC): Add Ofast. * config/i386/mingw32.h (ENDFILE_SPEC): Add Ofast. * config/ia64/linux.h (ENDFILE_SPEC): Add Ofast. * config/mips/linux.h (ENDFILE_SPEC): Add Ofast. Index: config/alpha/elf.h =================================================================== --- config/alpha/elf.h (revision 173309) +++ config/alpha/elf.h (working copy) @@ -397,7 +397,7 @@ do { \ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" /* Select a format to encode pointers in exception handling data. CODE Index: config/alpha/osf5.h =================================================================== --- config/alpha/osf5.h (revision 173309) +++ config/alpha/osf5.h (working copy) @@ -102,7 +102,7 @@ along with GCC; see the file COPYING3. "%{!shared:%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}" #define ENDFILE_SPEC \ - "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" #define MD_STARTFILE_PREFIX "/usr/lib/cmplrs/cc/" Index: config/alpha/netbsd.h =================================================================== --- config/alpha/netbsd.h (revision 173309) +++ config/alpha/netbsd.h (working copy) @@ -70,7 +70,7 @@ along with GCC; see the file COPYING3. #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{ffast-math|funsafe-math-optimizations:crtfm%O%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfm%O%s} \ %(netbsd_endfile_spec)" Index: config/sparc/linux.h =================================================================== --- config/sparc/linux.h (revision 173309) +++ config/sparc/linux.h (working copy) @@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. #undef ENDFILE_SPEC #define ENDFILE_SPEC \ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ - %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" + %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" /* This is for -profile to use -lc_p instead of -lc. */ #undef CC1_SPEC Index: config/sparc/sp64-elf.h =================================================================== --- config/sparc/sp64-elf.h (revision 173309) +++ config/sparc/sp64-elf.h (working copy) @@ -60,7 +60,7 @@ crtbegin.o%s \ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ crtend.o%s" /* Use the default (for now). */ Index: config/sparc/sp-elf.h =================================================================== --- config/sparc/sp-elf.h (revision 173309) +++ config/sparc/sp-elf.h (working copy) @@ -35,7 +35,7 @@ along with GCC; see the file COPYING3. #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ crtend.o%s crtn.o%s" /* Don't set the target flags, this is done by the linker script */ Index: config/sparc/linux64.h =================================================================== --- config/sparc/linux64.h (revision 173309) +++ config/sparc/linux64.h (working copy) @@ -59,7 +59,7 @@ along with GCC; see the file COPYING3. #undef ENDFILE_SPEC #define ENDFILE_SPEC \ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ - %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" + %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" /* The default code model. */ #undef SPARC_DEFAULT_CMODEL Index: config/sparc/freebsd.h =================================================================== --- config/sparc/freebsd.h (revision 173309) +++ config/sparc/freebsd.h (working copy) @@ -166,7 +166,7 @@ along with GCC; see the file COPYING3. #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \ FBSD_ENDFILE_SPEC /* We use GNU ld so undefine this so that attribute((init_priority)) works. */ Index: config/sparc/sol2.h =================================================================== --- config/sparc/sol2.h (revision 173309) +++ config/sparc/sol2.h (working copy) @@ -119,7 +119,7 @@ along with GCC; see the file COPYING3. #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ crtend.o%s crtn.o%s" /* Select a format to encode pointers in exception handling data. CODE Index: config/i386/cygwin.h =================================================================== --- config/i386/cygwin.h (revision 173309) +++ config/i386/cygwin.h (working copy) @@ -36,7 +36,7 @@ along with GCC; see the file COPYING3. #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}\ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}\ crtend.o%s" /* Normally, -lgcc is not needed since everything in it is in the DLL, but we Index: config/i386/gnu-user.h =================================================================== --- config/i386/gnu-user.h (revision 173309) +++ config/i386/gnu-user.h (working copy) @@ -108,7 +108,7 @@ along with GCC; see the file COPYING3. /* Similar to standard GNU userspace, but adding -ffast-math support. */ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ %{mpc32:crtprec32.o%s} \ %{mpc64:crtprec64.o%s} \ %{mpc80:crtprec80.o%s} \ Index: config/i386/gnu-user64.h =================================================================== --- config/i386/gnu-user64.h (revision 173309) +++ config/i386/gnu-user64.h (working copy) @@ -81,7 +81,7 @@ see the files COPYING3 and COPYING.RUNTI /* Similar to standard GNU userspace, but adding -ffast-math support. */ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ %{mpc32:crtprec32.o%s} \ %{mpc64:crtprec64.o%s} \ %{mpc80:crtprec80.o%s} \ Index: config/i386/darwin.h =================================================================== --- config/i386/darwin.h (revision 173309) +++ config/i386/darwin.h (working copy) @@ -129,7 +129,7 @@ extern int darwin_emit_branch_islands; #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ %{mpc32:crtprec32.o%s} \ %{mpc64:crtprec64.o%s} \ %{mpc80:crtprec80.o%s}" Index: config/i386/mingw32.h =================================================================== --- config/i386/mingw32.h (revision 173309) +++ config/i386/mingw32.h (working copy) @@ -143,7 +143,7 @@ along with GCC; see the file COPYING3. #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ crtend.o%s" /* Override startfile prefix defaults. */ Index: config/ia64/linux.h =================================================================== --- config/ia64/linux.h (revision 173309) +++ config/ia64/linux.h (working copy) @@ -50,7 +50,7 @@ do { \ /* Similar to standard Linux, but adding -ffast-math support. */ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" /* Define this for shared library support because it isn't in the main Index: config/mips/linux.h =================================================================== --- config/mips/linux.h (revision 173309) +++ config/mips/linux.h (working copy) @@ -140,5 +140,5 @@ extern const char *host_detect_local_cpu /* Similar to standard Linux, but adding -ffast-math support. */ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"