Subject: Re: Using current gcc & binutils and NetBSD -current speeds
To: Simon Burge <simonb@wasabisystems.com>
From: Ian Dall <ian@beware.dropbear.id.au>
List: port-pc532
Date: 12/02/2002 01:11:30
Simon Burge <simonb@wasabisystems.com> writes:

> Hi folks (and inparticular Ian(!)),
> 
> I have managed to build a kernel with current gcc and binutils.  Most
> files built with -O2, but I needed a build a couple with -O1 to avoid
> 
> 	internal compiler error: in general_operand, at recog.c:1023
> 
> type errors.

Try the following gcc fix:

diff -u -r1.6 ns32k.h
--- ns32k.h     1 Dec 2002 06:27:52 -0000       1.6
+++ ns32k.h     1 Dec 2002 13:29:53 -0000
@@ -1058,7 +1058,6 @@
   else if (GET_CODE (xfooy) == PRE_DEC)                                       \
     {                                                                  \
       if (REGNO (XEXP (xfooy, 0)) == STACK_POINTER_REGNUM) goto ADDR;  \
-      else abort ();                                                   \
     }                                                                  \
 }
 

This is in GO_IF_LEGITIMATE_ADDRESS. It should be sufficient to just
not go if it not a legitimate address. The abort is pointless. I've
got a make check running with this change at the moment, and if it
doesn't throw up any surprises, I'll put in a patch to the gcc people.

> Next, I needed to use -n with ld to link an nmagic kernel, I have
> something that boots ok to single user, but fails soon after trying to
> go to multi user.
> 
> 	...
> 	/dev/rsd0d: file system is clean; not checking
> 	fatal abort trap in supervisor mode
> 	trap type=2, pc=0xe010dd0b, tear=0xe23c7000, msr=0xa2
> 	panic: trap
> 	syncing disks... fatal abort trap in supervisor mode
> 	trap type=2, pc=0xe00c01cc, tear=0x10c, msr=0xa2
> 	panic: trap

You may be having a problem with N magic and relocation addresses. I
had success with ZMagic and changing TEXTADDR.

This is part of a patch which I submitted some time back but was never applied:

*** netbsd/src/sys/arch/pc532/conf/Makefile.pc532:1.1.1.2	Fri Jan  4 15:57:44 2002
--- netbsd/src/sys/arch/pc532/conf/Makefile.pc532	Mon Jun 17 22:30:19 2002
***************
*** 53,60 ****
  ##
  ## (5) link settings
  ##
! LINKFORMAT=	-z
! TEXTADDR?=	E0002000
  
  ##
  ## (6) port specific target dependencies
--- 53,67 ----
  ##
  ## (5) link settings
  ##
! 
! # The BFD based LD, defines the text start addess to be after the 32 byte
! # header. There is only a discrepency for ZMAGIC (the default).
! LINKFORMAT=
! .if defined(USE_NEW_TOOLCHAIN)
! TEXTADDR?=	0xe0002020
! .else
! TEXTADDR?=	0xe0002000
! .endif
  
  ##
  ## (6) port specific target dependencies


Note the comment which says that the extra 0x20 bytes offset only
happens with ZMagic. However, I have no idea if NMagic will work. The
-z flag is not respected by the new loader, but is not needed. It is
the default for old and new.

Ian