Subject: port-amiga/1827: Can't build GCC 2.7.2 on NetBSD-Amiga due to kernel bug?
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jehamby@lightside.com>
List: netbsd-bugs
Date: 12/07/1995 21:54:22
>Number:         1827
>Category:       port-amiga
>Synopsis:       There is a bug in NetBSD-Amiga preventing my GCC compile
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec  8 01:05:18 1995
>Last-Modified:
>Originator:     Jake Hamby
>Organization:
------------------------------------------------------------------------------
     Jake Hamby                         |   E-Mail:  jehamby@lightside.com
  Student, Cal Poly University, Pomona  |   System Administrator, JPL
------------------------------------------------------------------------------
>Release:        1.1
>Environment:

System: NetBSD amiga.lightside.com 1.1 NetBSD 1.1 (A500) #0: Thu Dec 7 
21:03:20 GMT 1995 jehamby@amiga.lightside.com:/usr/src/sys/arch/amiga/compile/
A500 amiga

Amiga 500 with Mega Midget Racer 68030/24MHz accelerator and GVP Series 
II SCSI controller.  4MB 32-bit RAM on accelerator + 4MB 16-bit RAM in 
SCSI controller + 1MB chip RAM.

>Description:

When attempting to compile GCC 2.7.2 on my system, two of the support 
programs GCC builds to create output files (genoutput and bi-arity) 
didn't work properly.  Specifically, "genoutput", which reads a CPU 
description file (config/m68k/m68k.md) and outputs some C source code
"insn-output.c" produced a corrupted output file (4 ASCII 0377 characters 
on line 434), and "bi-arity", which reads a file called bytecode.def and 
outputs a header file called bc-arity.h caused a segmentation fault.

MacBSD does not have this problem.  I've tested my system for bad SIMMs, 
tried it with two different kernels, three different GCC binaries (2.4.5 
plus 2.6.2 and 2.7.0 binaries I downloaded from ftp.netbsd.org), and even 
replaced my libc!  The identical genoutput and bi-arity executables work 
perfectly under MacBSD, but cause this problem on my Amiga consistently 
and repeatedly.  However, if I compile either program with -static, the 
problems do not occur.  If I compile genoutput with no optimization or 
debugging, then it works, and if I compile bi-arity WITH optimization or 
debugging, then it works, but the point is that both programs should work 
no matter what compiler flags I choose (and indeed this is the case with 
MacBSD).

I believe that I've eliminated every possibility except for some 
insidious bug in the Amiga port of the kernel, but I've tried building 
several custom kernels, turning various flags on and off (especially 
MACHINE_NONCONTIG which I assumed might not be well-tested) but to no avail.

>How-To-Repeat:

I'd like to be able to condense the specific problem into a small test 
program but I haven't had the time.  To reproduce (on my system at 
least), download and configure the GCC 2.7.2 source code, and type "make 
stamp-output" and "make CFLAGS= stamp-bcarity".  The first command should 
create an insn-output.c file with defect on line 434, and the second 
command should segmentation fault when it runs bi-arity.

>Fix:
	
Linking both programs statically fixes the problem with these particular 
programs, but I'm afraid that it only masks the problem.  After all, the 
exact same binaries cause no problems when copied to a MacBSD system, 
they shouldn't cause problems on an Amiga either.

In all other respects, NetBSD/Amiga seems very stable on my system, but 
because of this hard-to-track bug, I'm afraid to do any serious C 
compiling for fear that my output will be corrupted.  I wish that I had 
more time to narrow the specific problem down, but these are the facts as 
I know them.  If you can supply any kernel patches or would like me to 
supply any more information, please E-Mail the address above!  Thanks!

>Audit-Trail:
>Unformatted: