1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/gcc/no-unsafe-Ofast-math.patch
3 # Copyright (C) 2022 - 2023 The T2 SDE Project
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
8 # This patch file is dual-licensed. It is available under the license the
9 # patched project is licensed under, as long as it is an OpenSource license
10 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
11 # of the GNU General Public License version 2 as used by the T2 SDE.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 --- gcc-12.2.0/gcc/opts.cc.orig 2022-08-19 10:09:52.952667233 +0200
15 +++ gcc-12.2.0/gcc/opts.cc 2022-09-09 22:50:36.935305362 +0200
17 { OPT_LEVELS_3_PLUS, OPT__param_max_inline_insns_single_, NULL, 200 },
19 /* -Ofast adds optimizations to -O3. */
20 - { OPT_LEVELS_FAST, OPT_ffast_math, NULL, 1 },
21 + { OPT_LEVELS_FAST, OPT_ffast_math, NULL, -1 },
22 { OPT_LEVELS_FAST, OPT_fallow_store_data_races, NULL, 1 },
23 { OPT_LEVELS_FAST, OPT_fsemantic_interposition, NULL, 0 },
25 @@ -3238,14 +3238,14 @@
27 if (!opts->frontend_set_flag_unsafe_math_optimizations)
29 - opts->x_flag_unsafe_math_optimizations = set;
30 + opts->x_flag_unsafe_math_optimizations = set; // or not?
31 set_unsafe_math_optimizations_flags (opts, set);
33 if (!opts->frontend_set_flag_finite_math_only)
34 opts->x_flag_finite_math_only = set;
35 if (!opts->frontend_set_flag_errno_math)
36 opts->x_flag_errno_math = !set;
40 if (opts->frontend_set_flag_excess_precision == EXCESS_PRECISION_DEFAULT)
41 opts->x_flag_excess_precision
42 --- gcc-12.2.0/gcc/config/sparc/linux.h.vanilla 2022-09-08 15:50:03.197010229 +0200
43 +++ gcc-12.2.0/gcc/config/sparc/linux.h 2022-09-08 15:52:18.674017219 +0200
46 #define ENDFILE_SPEC \
47 GNU_USER_TARGET_ENDFILE_SPEC \
48 - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
49 + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
51 /* -mcpu=native handling only makes sense with compiler running on
53 --- gcc-12.2.0/gcc/config/sparc/freebsd.h.vanilla 2022-09-08 15:50:03.194010229 +0200
54 +++ gcc-12.2.0/gcc/config/sparc/freebsd.h 2022-09-08 15:52:18.674017219 +0200
58 #define ENDFILE_SPEC \
59 - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \
60 + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \
63 /* We use GNU ld so undefine this so that attribute((init_priority)) works. */
64 --- gcc-12.2.0/gcc/config/sparc/sp64-elf.h.vanilla 2022-09-08 15:50:03.191010229 +0200
65 +++ gcc-12.2.0/gcc/config/sparc/sp64-elf.h 2022-09-08 15:52:18.675017219 +0200
69 #define ENDFILE_SPEC \
70 - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \
71 + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \
74 /* Use the default (for now). */
75 --- gcc-12.2.0/gcc/config/sparc/sp-elf.h.vanilla 2022-09-08 15:50:03.188010229 +0200
76 +++ gcc-12.2.0/gcc/config/sparc/sp-elf.h 2022-09-08 15:52:18.675017219 +0200
80 #define ENDFILE_SPEC \
81 - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \
82 + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \
85 /* Don't set the target flags, this is done by the linker script */
86 --- gcc-12.2.0/gcc/config/sparc/linux64.h.vanilla 2022-09-08 15:50:03.185010229 +0200
87 +++ gcc-12.2.0/gcc/config/sparc/linux64.h 2022-09-08 15:52:18.674017219 +0200
90 #define ENDFILE_SPEC \
91 GNU_USER_TARGET_ENDFILE_SPEC \
92 - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
93 + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
95 /* The default code model. */
96 #undef SPARC_DEFAULT_CMODEL
97 --- gcc-12.2.0/gcc/config/alpha/linux.h.vanilla 2022-09-08 15:50:03.200010230 +0200
98 +++ gcc-12.2.0/gcc/config/alpha/linux.h 2022-09-08 15:52:18.649017217 +0200
102 #define ENDFILE_SPEC \
103 - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \
104 + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \
105 %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
107 #define LINK_GCC_C_SEQUENCE_SPEC \
108 --- gcc-12.2.0/gcc/config/loongarch/gnu-user.h.vanilla 2022-09-08 15:50:03.203010230 +0200
109 +++ gcc-12.2.0/gcc/config/loongarch/gnu-user.h 2022-09-08 15:52:18.667017218 +0200
111 /* Similar to standard Linux, but adding -ffast-math support. */
112 #undef GNU_USER_TARGET_MATHFILE_SPEC
113 #define GNU_USER_TARGET_MATHFILE_SPEC \
114 - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
115 + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
118 #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
119 --- gcc-12.2.0/gcc/config/arm/linux-eabi.h.vanilla 2022-09-08 15:50:03.209010230 +0200
120 +++ gcc-12.2.0/gcc/config/arm/linux-eabi.h 2022-09-08 15:52:18.656017218 +0200
124 #define ENDFILE_SPEC \
125 - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \
126 + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \
127 LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
129 /* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
130 --- gcc-12.2.0/gcc/config/arm/unknown-elf.h.vanilla 2022-09-08 15:50:03.206010230 +0200
131 +++ gcc-12.2.0/gcc/config/arm/unknown-elf.h 2022-09-08 15:52:18.656017218 +0200
134 #undef STARTFILE_SPEC
135 #define STARTFILE_SPEC \
136 - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \
137 + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \
138 UNKNOWN_ELF_STARTFILE_SPEC
140 #define UNKNOWN_ELF_ENDFILE_SPEC "crtend%O%s crtn%O%s"
141 --- gcc-12.2.0/gcc/config/ia64/linux.h.vanilla 2022-09-08 15:50:03.212010230 +0200
142 +++ gcc-12.2.0/gcc/config/ia64/linux.h 2022-09-08 15:52:18.667017218 +0200
144 /* Similar to standard Linux, but adding -ffast-math support. */
146 #define ENDFILE_SPEC \
147 - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \
148 + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \
149 %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
151 /* Define this for shared library support because it isn't in the main
152 --- gcc-12.2.0/gcc/config/aarch64/aarch64-elf-raw.h.vanilla 2022-09-08 15:50:03.220010231 +0200
153 +++ gcc-12.2.0/gcc/config/aarch64/aarch64-elf-raw.h 2022-09-08 15:52:18.645017217 +0200
155 #define STARTFILE_SPEC " crti%O%s crtbegin%O%s crt0%O%s"
156 #define ENDFILE_SPEC \
157 " crtend%O%s crtn%O%s " \
158 - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
159 + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
162 #define LINK_SPEC "%{h*} \
163 --- gcc-12.2.0/gcc/config/aarch64/aarch64-freebsd.h.vanilla 2022-09-08 15:50:03.218010231 +0200
164 +++ gcc-12.2.0/gcc/config/aarch64/aarch64-freebsd.h 2022-09-08 15:52:18.646017217 +0200
166 #define LINK_SPEC FBSD_TARGET_LINK_SPEC AARCH64_ERRATA_LINK_SPEC
168 #define GNU_USER_TARGET_MATHFILE_SPEC \
169 - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
170 + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
173 #define ENDFILE_SPEC \
174 --- gcc-12.2.0/gcc/config/aarch64/aarch64-linux.h.vanilla 2022-09-08 15:50:03.215010230 +0200
175 +++ gcc-12.2.0/gcc/config/aarch64/aarch64-linux.h 2022-09-08 15:52:18.646017217 +0200
177 #define LINK_SPEC LINUX_TARGET_LINK_SPEC AARCH64_ERRATA_LINK_SPEC
179 #define GNU_USER_TARGET_MATHFILE_SPEC \
180 - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
181 + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
184 #define ENDFILE_SPEC \
185 --- gcc-12.2.0/gcc/config/mips/gnu-user.h.vanilla 2022-09-08 15:50:03.238010232 +0200
186 +++ gcc-12.2.0/gcc/config/mips/gnu-user.h 2022-09-08 15:52:18.668017218 +0200
188 /* Similar to standard Linux, but adding -ffast-math support. */
189 #undef GNU_USER_TARGET_MATHFILE_SPEC
190 #define GNU_USER_TARGET_MATHFILE_SPEC \
191 - "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
192 + "%{ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
194 #define ENDFILE_SPEC \
195 GNU_USER_TARGET_MATHFILE_SPEC " " \