Makefiles: compile 32bit Winsows with `-O0`
authorJan Vrany <jan.vrany@labware.com>
Wed, 02 Dec 2020 21:11:00 +0000
changeset 316 5713a3dd8bd8
parent 315 b7422e82eef0
child 317 a85c0bcfea43
Makefiles: compile 32bit Winsows with `-O0` This is a horrible hack - on i686 St/X is known to crash when compiled with -O2 using GCC >9. To circumvent this, compile 32bit version with `-O0` which is known to work. Naturally, this is horrible hack, but in the past, people made so many "cool optimizations" on i686 only that they break with every new GCC (UB). There are so many it would take significant effort to clean up. And there's little gain from that as of today (Dec 2020). So, sorry for that, but no optimizations on 32bit Windows.
makelib/definitions-w.make
--- a/makelib/definitions-w.make	Tue Dec 01 19:48:05 2020 +0000
+++ b/makelib/definitions-w.make	Wed Dec 02 21:11:00 2020 +0000
@@ -775,7 +775,23 @@
 LIB_SUBSYSTEM=console
 
 !if defined(USEMINGW32) || defined(USEMINGW64)
-OPT=-fPIC -O2 -fno-strict-aliasing -Wno-strict-aliasing -fno-stack-protector -ggdb3 -pipe -U_FORTIFY_SOURCE -D__USE_MINGW_ANSI_STDIO=0
+OPT_COMMON=-fPIC -fno-strict-aliasing -Wno-strict-aliasing -fno-stack-protector -ggdb3 -pipe -U_FORTIFY_SOURCE -D__USE_MINGW_ANSI_STDIO=0
+! if defined(USEMINGW32)
+#
+# A horrible hack - on i686 St/X is known to crash when compiled with -O2.
+# To circumvent this, compile 32bit version with -O0 which is known to work. 
+#
+# Naturally, this is horrible hack, but in the past, people made so many "cool optimizations"
+# in i686 only that they break with every new GCC (UB). There are so many it would
+# take significant effort to clean up. And there's little gain from that as of today
+# (Dec 2020).
+#
+# So, sorry for that, but:
+#
+OPT=$(OPT_COMMON) -O0
+! else
+OPT=$(OPT_COMMON) -O2
+! endif
 CFLAGS=$(OPT) $(CFLAGS1) $(CFLAGS2) $(LOCALINCLUDES) $(CLOCAL_INCL) $(CFLAGS_LOCAL)
 !endif