From peter@vk2pj.alcatel.com.au  Mon Jan  6 01:33:25 1997
Received: from gatekeeper.alcatel.com.au (gatekeeper.alcatel.com.au [203.17.66.1])
          by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id BAA22859
          for <FreeBSD-gnats-submit@freebsd.org>; Mon, 6 Jan 1997 01:33:20 -0800 (PST)
Received: from 139.188.22.50 (139.188.22.50) by gatekeeper.alcatel.com.au
 (PMDF V5.0-5 #11861) id <01IDWMA0L9ZK0008KC@gatekeeper.alcatel.com.au> for
 FreeBSD-gnats-submit@freebsd.org; Mon, 06 Jan 1997 20:31:58 +1000
Received: from vk2pj.alcatel.com.au (vk2pj.alcatel.com.au)
 by cbd.alcatel.com.au (PMDF V5.0-5 #9241)
 id <01IDWM8VV87K9QVITG@cbd.alcatel.com.au> for
 FreeBSD-gnats-submit@freebsd.org; Mon, 06 Jan 1997 20:31:07 +1100
Received: (from peter@localhost) by vk2pj.alcatel.com.au (8.7.5/8.7.3)
 id UAA27078; Mon, 06 Jan 1997 20:32:27 +1100 (EST)
Message-Id: <199701060932.UAA27078@vk2pj.alcatel.com.au>
Date: Mon, 06 Jan 1997 20:32:27 +1100 (EST)
From: peter.jeremy@alcatel.com.au
Reply-To: peter.jeremy@alcatel.com.au
To: FreeBSD-gnats-submit@freebsd.org
Subject: gcc built with i486 default can't compile biosboot files
X-Send-Pr-Version: 3.2

>Number:         2381
>Category:       i386
>Synopsis:       gcc built with i486 default can't compile biosboot files
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan  6 01:40:01 PST 1997
>Closed-Date:    Tue Mar 25 14:48:48 PST 1997
>Last-Modified:  Tue Mar 25 14:49:24 PST 1997
>Originator:     Peter Jeremy
>Release:        FreeBSD 2.1-STABLE i386
>Organization:
Peter Jeremy (VK2PJ)			peter.jeremy@alcatel.com.au
Alcatel Australia Limited
41 Mandible St				Phone: +61 2 9690 5019
ALEXANDRIA  NSW  2015			Fax:   +61 2 9690 5247
>Environment:

gcc built with i486 as default target CPU.

>Description:

When gcc is built with the i486 as the default target, code alignment is
increased to match the i486 cache.  This has the side-effect of increasing
code size.  In most cases, this is unimportant, however the BIOS bootstrap
programs are restricted in size and the increased code size causes the
stage 2 bootstrap to exceed its allowable size.

>How-To-Repeat:

# cd /sys/i386/boot/biosboot
# make			(or make "CC=cc -m486")
...
cp -p boot boot.strip
strip boot.strip
size boot.strip
text	data	bss	dec	hex
8048	112	51132	59292	e79c
dd if=boot.strip of=boot.nohdr ibs=32 skip=1 obs=1024b
255+0 records in
0+1 records out
8160 bytes transferred in 1 secs (8160 bytes/sec)
ls -l boot.nohdr
-rw-rw-r--  1 root  wheel  8160 Jan  4 13:10 boot.nohdr
dd if=boot.nohdr of=boot1 bs=512 count=1
1+0 records in
1+0 records out
512 bytes transferred in 1 secs (512 bytes/sec)
dd if=boot.nohdr of=boot2 bs=512 skip=1
14+1 records in
14+1 records out
7648 bytes transferred in 1 secs (7648 bytes/sec)
*** Boot2 is too BIG ***
*** Error code 2

Stop.
#

>Fix:
	
Force gcc to assume an i386 (and hence align to words rather than
cache lines) when building the BIOS bootstraps:

*** /cdrom/usr/src/sys/i386/boot/biosboot/Makefile	Mon Jul  1 12:35:36 1996
--- /usr/src/sys/i386/boot/biosboot/Makefile	Sun Dec 15 09:53:24 1996
***************
*** 11,16 ****
--- 11,17 ----
  CFLAGS=		-O2 -DDO_BAD144 -DBOOTWAIT=${BOOTWAIT} -DCOMCONSOLE=0x3F8
  CFLAGS+=	-DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK}
  CFLAGS+=	-I${.CURDIR} -I${.CURDIR}/../..
+ CFLAGS+=	-m386	# Reduce alignment requirements so it fits
  
  # force usage of serial console instead of keyboard probing
  #CFLAGS+=	-DFORCE_COMCONSOLE
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mpp 
State-Changed-When: Tue Mar 25 14:48:48 PST 1997 
State-Changed-Why:  
Fixed in rev 1.55 of sys/i386/boot/biosboot/Makefile  
for 2.2 and 3.0-current. 
>Unformatted:
