# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/gcc/no-unsafe-Ofast-math.patch # Copyright (C) 2022 - 2023 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License version 2 as used by the T2 SDE. # --- T2-COPYRIGHT-NOTE-END --- --- gcc-12.2.0/gcc/opts.cc.orig 2022-08-19 10:09:52.952667233 +0200 +++ gcc-12.2.0/gcc/opts.cc 2022-09-09 22:50:36.935305362 +0200 @@ -688,7 +688,7 @@ { OPT_LEVELS_3_PLUS, OPT__param_max_inline_insns_single_, NULL, 200 }, /* -Ofast adds optimizations to -O3. */ - { OPT_LEVELS_FAST, OPT_ffast_math, NULL, 1 }, + { OPT_LEVELS_FAST, OPT_ffast_math, NULL, -1 }, { OPT_LEVELS_FAST, OPT_fallow_store_data_races, NULL, 1 }, { OPT_LEVELS_FAST, OPT_fsemantic_interposition, NULL, 0 }, @@ -3238,14 +3238,14 @@ { if (!opts->frontend_set_flag_unsafe_math_optimizations) { - opts->x_flag_unsafe_math_optimizations = set; + opts->x_flag_unsafe_math_optimizations = set; // or not? set_unsafe_math_optimizations_flags (opts, set); } if (!opts->frontend_set_flag_finite_math_only) opts->x_flag_finite_math_only = set; if (!opts->frontend_set_flag_errno_math) opts->x_flag_errno_math = !set; - if (set) + if (set == 1) { if (opts->frontend_set_flag_excess_precision == EXCESS_PRECISION_DEFAULT) opts->x_flag_excess_precision --- gcc-12.2.0/gcc/config/sparc/linux.h.vanilla 2022-09-08 15:50:03.197010229 +0200 +++ gcc-12.2.0/gcc/config/sparc/linux.h 2022-09-08 15:52:18.674017219 +0200 @@ -30,7 +30,7 @@ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ GNU_USER_TARGET_ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" /* -mcpu=native handling only makes sense with compiler running on a SPARC chip. */ --- gcc-12.2.0/gcc/config/sparc/freebsd.h.vanilla 2022-09-08 15:50:03.194010229 +0200 +++ gcc-12.2.0/gcc/config/sparc/freebsd.h 2022-09-08 15:52:18.674017219 +0200 @@ -133,7 +133,7 @@ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \ + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \ FBSD_ENDFILE_SPEC /* We use GNU ld so undefine this so that attribute((init_priority)) works. */ --- gcc-12.2.0/gcc/config/sparc/sp64-elf.h.vanilla 2022-09-08 15:50:03.191010229 +0200 +++ gcc-12.2.0/gcc/config/sparc/sp64-elf.h 2022-09-08 15:52:18.675017219 +0200 @@ -44,7 +44,7 @@ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \ + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \ crtend.o%s crtn.o%s" /* Use the default (for now). */ --- gcc-12.2.0/gcc/config/sparc/sp-elf.h.vanilla 2022-09-08 15:50:03.188010229 +0200 +++ gcc-12.2.0/gcc/config/sparc/sp-elf.h 2022-09-08 15:52:18.675017219 +0200 @@ -32,7 +32,7 @@ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \ + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \ crtend.o%s crtn.o%s" /* Don't set the target flags, this is done by the linker script */ --- gcc-12.2.0/gcc/config/sparc/linux64.h.vanilla 2022-09-08 15:50:03.185010229 +0200 +++ gcc-12.2.0/gcc/config/sparc/linux64.h 2022-09-08 15:52:18.674017219 +0200 @@ -47,7 +47,7 @@ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ GNU_USER_TARGET_ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" /* The default code model. */ #undef SPARC_DEFAULT_CMODEL --- gcc-12.2.0/gcc/config/alpha/linux.h.vanilla 2022-09-08 15:50:03.200010230 +0200 +++ gcc-12.2.0/gcc/config/alpha/linux.h 2022-09-08 15:52:18.649017217 +0200 @@ -106,7 +106,7 @@ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \ + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" #define LINK_GCC_C_SEQUENCE_SPEC \ --- gcc-12.2.0/gcc/config/loongarch/gnu-user.h.vanilla 2022-09-08 15:50:03.203010230 +0200 +++ gcc-12.2.0/gcc/config/loongarch/gnu-user.h 2022-09-08 15:52:18.667017218 +0200 @@ -47,7 +47,7 @@ /* Similar to standard Linux, but adding -ffast-math support. */ #undef GNU_USER_TARGET_MATHFILE_SPEC #define GNU_USER_TARGET_MATHFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" #undef LIB_SPEC #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC --- gcc-12.2.0/gcc/config/arm/linux-eabi.h.vanilla 2022-09-08 15:50:03.209010230 +0200 +++ gcc-12.2.0/gcc/config/arm/linux-eabi.h 2022-09-08 15:52:18.656017218 +0200 @@ -124,7 +124,7 @@ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \ + "%{ffast-math|funsafe-math-optimizations:%{!shared: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 --- gcc-12.2.0/gcc/config/arm/unknown-elf.h.vanilla 2022-09-08 15:50:03.206010230 +0200 +++ gcc-12.2.0/gcc/config/arm/unknown-elf.h 2022-09-08 15:52:18.656017218 +0200 @@ -33,7 +33,7 @@ #undef STARTFILE_SPEC #define STARTFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \ + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \ UNKNOWN_ELF_STARTFILE_SPEC #define UNKNOWN_ELF_ENDFILE_SPEC "crtend%O%s crtn%O%s" --- gcc-12.2.0/gcc/config/ia64/linux.h.vanilla 2022-09-08 15:50:03.212010230 +0200 +++ gcc-12.2.0/gcc/config/ia64/linux.h 2022-09-08 15:52:18.667017218 +0200 @@ -49,7 +49,7 @@ /* Similar to standard Linux, but adding -ffast-math support. */ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \ + "%{ffast-math|funsafe-math-optimizations:%{!shared: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 --- gcc-12.2.0/gcc/config/aarch64/aarch64-elf-raw.h.vanilla 2022-09-08 15:50:03.220010231 +0200 +++ gcc-12.2.0/gcc/config/aarch64/aarch64-elf-raw.h 2022-09-08 15:52:18.645017217 +0200 @@ -25,7 +25,7 @@ #define STARTFILE_SPEC " crti%O%s crtbegin%O%s crt0%O%s" #define ENDFILE_SPEC \ " crtend%O%s crtn%O%s " \ - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" #ifndef LINK_SPEC #define LINK_SPEC "%{h*} \ --- gcc-12.2.0/gcc/config/aarch64/aarch64-freebsd.h.vanilla 2022-09-08 15:50:03.218010231 +0200 +++ gcc-12.2.0/gcc/config/aarch64/aarch64-freebsd.h 2022-09-08 15:52:18.646017217 +0200 @@ -50,7 +50,7 @@ #define LINK_SPEC FBSD_TARGET_LINK_SPEC AARCH64_ERRATA_LINK_SPEC #define GNU_USER_TARGET_MATHFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" #undef ENDFILE_SPEC #define ENDFILE_SPEC \ --- gcc-12.2.0/gcc/config/aarch64/aarch64-linux.h.vanilla 2022-09-08 15:50:03.215010230 +0200 +++ gcc-12.2.0/gcc/config/aarch64/aarch64-linux.h 2022-09-08 15:52:18.646017217 +0200 @@ -50,7 +50,7 @@ #define LINK_SPEC LINUX_TARGET_LINK_SPEC AARCH64_ERRATA_LINK_SPEC #define GNU_USER_TARGET_MATHFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" #undef ENDFILE_SPEC #define ENDFILE_SPEC \ --- gcc-12.2.0/gcc/config/mips/gnu-user.h.vanilla 2022-09-08 15:50:03.238010232 +0200 +++ gcc-12.2.0/gcc/config/mips/gnu-user.h 2022-09-08 15:52:18.668017218 +0200 @@ -139,7 +139,7 @@ /* Similar to standard Linux, but adding -ffast-math support. */ #undef GNU_USER_TARGET_MATHFILE_SPEC #define GNU_USER_TARGET_MATHFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" #undef ENDFILE_SPEC #define ENDFILE_SPEC \ GNU_USER_TARGET_MATHFILE_SPEC " " \