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.
This commit is contained in:
David E. O'Brien 2001-08-16 06:05:18 +00:00
parent cc0235828a
commit d549989694
5 changed files with 36 additions and 8 deletions

View File

@ -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;

View File

@ -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
#

View File

@ -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

View File

@ -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
#

View File

@ -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