summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2001-08-16 06:05:18 +0000
committerobrien <obrien@FreeBSD.org>2001-08-16 06:05:18 +0000
commitcd3f3aab8e337abe90764fb04a24c977624fdecd (patch)
tree025a5ff5558a3dc152596f4912bf98e8b818132e
parentcd8f761f0ab2cc4e533f738ed4bcf1712cb5b6ce (diff)
downloadFreeBSD-src-cd3f3aab8e337abe90764fb04a24c977624fdecd.zip
FreeBSD-src-cd3f3aab8e337abe90764fb04a24c977624fdecd.tar.gz
Add the `WANT_FORCE_OPTIMIZATION_DOWNGRADE' knob. If set to an integer
value, it forces GCC to not optimize above this level. For intance, GCC made with "WANT_FORCE_OPTIMIZATION_DOWNGRADE=1" is a good setting for the Alpha platform when building ports.
-rw-r--r--contrib/gcc/toplev.c19
-rw-r--r--etc/defaults/make.conf6
-rw-r--r--gnu/usr.bin/cc/Makefile.inc4
-rw-r--r--share/examples/etc/make.conf6
-rw-r--r--share/man/man5/make.conf.59
5 files changed, 36 insertions, 8 deletions
diff --git a/contrib/gcc/toplev.c b/contrib/gcc/toplev.c
index 95835bb..e9d8886 100644
--- a/contrib/gcc/toplev.c
+++ b/contrib/gcc/toplev.c
@@ -4851,17 +4851,22 @@ main (argc, argv)
if (optimize_val != -1)
{
optimize = optimize_val;
-#ifdef __alpha__
+#ifdef FORCE_OPTIMIZATION_DOWNGRADE
+#warning FORCE_OPTIMIZATION_DOWNGRADE
+ if (optimize > FORCE_OPTIMIZATION_DOWNGRADE)
+ {
+ optimize = FORCE_OPTIMIZATION_DOWNGRADE;
+ warning ("\n***\n***\t-O%d converted to \"-O%d\" due to optimizer bugs on this platform\n***\n",
+ optimize_val,
+ FORCE_OPTIMIZATION_DOWNGRADE);
+
+ }
+#endif /*FORCE_OPTIMIZATION_DOWNGRADE*/
+#if defined(__alpha__)
if (optimize > 1)
{
- #ifdef FORCE_OPTIMIZATION_DOWNGRADE
- optimize = 1;
- warning ("\n***\n***\t-O%d converted to \"-O1\" due to optimizer bugs on this platform\n***\n",
- optimize_val);
- #else
warning ("\n***\n***\tThe -O%d flag TRIGGERS KNOWN OPTIMIZER BUGS ON THIS PLATFORM\n***\n",
optimize_val);
- #endif
}
#endif /*__alpha__*/
optimize_size = 0;
diff --git a/etc/defaults/make.conf b/etc/defaults/make.conf
index ca68587..683f286 100644
--- a/etc/defaults/make.conf
+++ b/etc/defaults/make.conf
@@ -65,6 +65,12 @@ BDECFLAGS= -W -Wall -ansi -pedantic -Wbad-function-cast -Wcast-align \
#
#COPTFLAGS= -O -pipe
#
+# To build the system compiler such that it forces high optimization levels to
+# a lower one. GCC -O2+ is known to trigger known optimizer bugs at various
+# times -- this is worse on the Alpha platform. The value assigned here will
+# be the highest optimization value used.
+#WANT_FORCE_OPTIMIZATION_DOWNGRADE=1
+#
# Compare before install
#INSTALL=install -C
#
diff --git a/gnu/usr.bin/cc/Makefile.inc b/gnu/usr.bin/cc/Makefile.inc
index 4fe0547..7b6a2ec 100644
--- a/gnu/usr.bin/cc/Makefile.inc
+++ b/gnu/usr.bin/cc/Makefile.inc
@@ -39,6 +39,10 @@ CFLAGS+= -DHAIFA
CFLAGS+= -DCROSS_COMPILE
.endif
+.if defined(WANT_FORCE_OPTIMIZATION_DOWNGRADE)
+CFLAGS+= -DFORCE_OPTIMIZATION_DOWNGRADE=${WANT_FORCE_OPTIMIZATION_DOWNGRADE}
+.endif
+
.if exists(${.OBJDIR}/../cc_tools)
CFLAGS+= -I${.OBJDIR}/../cc_tools
.endif
diff --git a/share/examples/etc/make.conf b/share/examples/etc/make.conf
index ca68587..683f286 100644
--- a/share/examples/etc/make.conf
+++ b/share/examples/etc/make.conf
@@ -65,6 +65,12 @@ BDECFLAGS= -W -Wall -ansi -pedantic -Wbad-function-cast -Wcast-align \
#
#COPTFLAGS= -O -pipe
#
+# To build the system compiler such that it forces high optimization levels to
+# a lower one. GCC -O2+ is known to trigger known optimizer bugs at various
+# times -- this is worse on the Alpha platform. The value assigned here will
+# be the highest optimization value used.
+#WANT_FORCE_OPTIMIZATION_DOWNGRADE=1
+#
# Compare before install
#INSTALL=install -C
#
diff --git a/share/man/man5/make.conf.5 b/share/man/man5/make.conf.5
index f21660e..538493a 100644
--- a/share/man/man5/make.conf.5
+++ b/share/man/man5/make.conf.5
@@ -249,7 +249,7 @@ Controls the compiler settings when building the
kernel.
Optimization levels above
.Oo Fl O ( O2 , No ...\& ) Oc
-are not supported.
+are not guaranteed to work.
.It Va KERNEL
.Pq Vt str
Controls which kernel configurations will be
@@ -538,6 +538,13 @@ command when building
.It Va SENDMAIL_DPADD
.Pq Vt str
This variable is undocumented.
+.It Va WANT_FORCE_OPTIMIZATION_DOWNGRADE
+.Pq Vt int
+Causes the system compiler to be built such that it forces high optimization
+levels to a lower one.
+GCC -O2 and above is known to trigger known optimizer bugs at various
+times -- this is worse on the Alpha platform.
+The value assigned is the highest optimization value used.
.El
.Pp
The following list provides a name and short description for variables
OpenPOWER on IntegriCloud