Subject: toolchain/18271: gcc without -O and with -mcpu=pentiumpro -march=pentiumpro is busted.
To: None <>
From: None <>
List: netbsd-bugs
Date: 09/11/2002 23:54:54
>Number:         18271
>Category:       toolchain
>Synopsis:       gcc without -O can't build an i386 GENERIC kernel.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 11 16:55:00 PDT 2002
>Originator:     Thor Lancelot Simon
>Release:        NetBSD-current, sources from anoncvs 2002-09-11
The NetBSD Foundation
NetBSD enola-gay 1.6H NetBSD 1.6H (ENOLA-GAY) #8: Wed Sep 11 16:54:16 EDT 2002     root@enola-gay:/usr/src/sys/arch/i386/compile/ENOLA-GAY i386
Architecture: i386
Machine: i386
Our toolchain gcc cannot compile if_pcn.c if -mcpu=pentiumpro 
-march=pentiumpro are given but no -O flag is given.  It fails with an
unrecognized instruction on the closing brace of pcn_init:

--- if_pcn.o ---
/usr/local/tools/bin/i386--netbsdelf-gcc  -ffreestanding  -mcpu=pentiumpro -march=pentiumpro -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wno-uninitialized  -Di386 -I.  -I/usr/src/sys/arch -I/usr/src/sys -nostdinc -DLKM -DMAXUSERS=32 -D_KERNEL -D_KERNEL_OPT   -c /usr/src/sys/dev/pci/if_pcn.c
/usr/src/sys/dev/pci/if_pcn.c: In function `pcn_init':
/usr/src/sys/dev/pci/if_pcn.c:1768: internal error--unrecognizable insn:
(insn 644 643 646 (set (reg:SI 170)
                (const_int 512 [0x200])
            ]  5)) -1 (nil)
*** [if_pcn.o] Error code 1
1 error

nbmake: stopped in /usr/obj/.i386/sys/arch/i386/compile/GENERIC
*** Error code 2

nbmake: stopped in /usr/src/etc
make release finished at: Wed Sep 11 19:13:22 EDT 2002
One way to see this, as discussed in another PR I just filed, is to put
COPTS+=-mcpu=pentiumpro -march=pentiumpro in your /etc/mk.conf and then
try to build a release.  A bug in the build machinery will cause the
standard COPTS to not be emitted into the kernel Makefile, thus triggering
this bug.