Subject: Re: EGCS 1.1 UPDATE rev. 5 / m68k / MIN/MAX
To: None <tech-toolchain@netbsd.org>
From: Erik Bertelsen <erik@mediator.uni-c.dk>
List: tech-toolchain
Date: 08/19/1998 23:18:04
On Wed, Aug 19, 1998 at 10:30:29AM -0400, Todd Vierling wrote:
> - m68k: Set up but not yet tested.  I need volunteer(s).

I still had the problems with MIN/MAX being redefined with the sup updates
since my first mac68k report.

The problem is that <sys/param.h> defines MIN and MAX, but gcc's
machmode.h unconditionally #undef's and #define's them as well. This
works OK, if param.h is included before machmode.h, and any later
includes of param.h don't harm, as it protects itself against double
includes.

I first kludged my way through this problem to actually build egcs,
but now I have a suggested patch (based on how i386/i386.c looks):


Index: dist/gcc/config/m68k/m68k.c
===================================================================
RCS file: /home/cvs-base/src/gnu/dist/gcc/config/m68k/m68k.c,v
retrieving revision 1.1.1.3
diff -c -r1.1.1.3 m68k.c
*** m68k.c      1998/08/17 15:28:09     1.1.1.3
--- m68k.c      1998/08/19 19:57:01
***************
*** 21,26 ****
--- 21,27 ----
  
  /* Some output-actions in m68k.md need these.  */
  #include "config.h"
+ #include "system.h"
  #include <stdio.h>
  #include "tree.h"
  #include "rtl.h"

The purpose of this fix is to include "system.h" very early to
get param.h included before machmode.h. i386/i386.c also includes
"system.h" just after including "config.h", so I guess that this
is really ok.

With my kludge (where I made the inclusion of "system.h" in one
of the other header files before including "machmode.h") I have
now done

     wipe out /usr/obj/gnu/usr.bin/egcs completely
     cd src/gnu/usr.bin/egcs
     make depend&&make&&make install
     make cleandir&&make && make install
     make cleandir &&make depend&&make&&make install

all these without warnings or errors.

With the resulting compiler I have also rebuilt my kernel (mac68k)
completely with a few (expected :-() warnings about values possibly
being used without initialization as well as another warning about
data alignment (to be reported later), so I hade to turn off -Werror.

I'm running the resulting kernel while typing this...


With the resulting compiler I have also rebuilt my kernel (mac68k)
completely with a few (expected :-() warnings about values possibly
being used without initialization as well as another warning about
data alignment (to be reported later), so I hade to turn off -Werror.

I'm running the resulting kernel while typing this...

One observation, though:
-rwxr-xr-x  1 erik  wheel  1082849 Aug 19 22:17 /netbsd
-rwxr-xr-x  1 erik  wheel  1079146 Aug 11 21:40 /netbsd.168
-rwxr-xr-x  1 erik  wheel  1080075 Aug 14 00:01 /netbsd.169
-rwxr-xr-x  1 erik  wheel  1080485 Aug 17 22:06 /netbsd.170
-rwxr-xr-x  1 erik  wheel  1080493 Aug 18 20:33 /netbsd.171

/netbsd (the egcs-1.1 built kernel) is 2k+ larger than the
previous few kernels (all based on same config file).

All tests are done on a mac68k-current system

Next step is to report the exact warnings issued by egcs when
building the mac68k kernel -- then user land...

regards Erik Bertelsen