Subject: port-i386/11067: bootblocks too big when built with custom optimization
To: None <gnats-bugs@gnats.netbsd.org>
From: Johnny C. Lam <lamj@stat.cmu.edu>
List: netbsd-bugs
Date: 09/22/2000 13:49:25
>Number:         11067
>Category:       port-i386
>Synopsis:       bootblocks too big when built with custom optimization
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 22 13:55:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Johnny C. Lam
>Release:        NetBSD-current source date 20000904
>Organization:
	Department of Statistics, Carnegie Mellon University
>Environment:
System: NetBSD mariposa.home.net 1.5E NetBSD 1.5E (MARIPOSA) #0: Mon Sep 4 21:58:00 EDT 2000 jlam@mariposa.home.net:/local/obj/local/src/sys/arch/i386/compile/MARIPOSA i386


>Description:
	When the i386 bootblocks in sys/arch/i386/stand are built with a line
like the following in mk.conf, the resulting files are too large to fit into
10 blocks:

	CFLAGS+=	-mcpu=pentiumpro -march=pentiumpro

>How-To-Repeat:
	Add the above line to mk.conf.  Try to do a "make release" and see it
fail when making install floppies.

>Fix:
	The following patch explicitly sets the flags for the compiler to
what is needed to build bootblocks of the correct size.  It also moves the
commented-out lines for each of the separate Makefiles below the inclusion
of Makefile.booters where they could be used to override the settings for
CFLAGS if uncommented.  I've tested this fix on a -current system build from
sources dated 20000917.

Index: sys/arch/i386/stand/Makefile.booters
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/i386/stand/Makefile.booters,v
retrieving revision 1.26
diff -u -r1.26 Makefile.booters
--- sys/arch/i386/stand/Makefile.booters	2000/07/12 21:05:35	1.26
+++ sys/arch/i386/stand/Makefile.booters	2000/09/22 20:31:18
@@ -59,6 +59,8 @@
 
 .include <bsd.own.mk>
 
+CFLAGS= -Os -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-main
+
 .if ${OBJECT_FMT} == "ELF"
 LDFLAGS=-M -e start 	# -N does not work properly.
 .else
Index: sys/arch/i386/stand/biosboot/Makefile
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/i386/stand/biosboot/Makefile,v
retrieving revision 1.32
diff -u -r1.32 Makefile
--- sys/arch/i386/stand/biosboot/Makefile	2000/08/22 02:46:30	1.32
+++ sys/arch/i386/stand/biosboot/Makefile	2000/09/22 20:31:26
@@ -55,9 +55,6 @@
 #set PRIM_LOADSZ to <=9 to make a 720k boot floppy (default: 15)
 #CPPFLAGS+= -DPRIM_LOADSZ=9
 
-#CFLAGS= -O2 -fomit-frame-pointer -fno-defer-pop
-CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-main
-
 SAMISCCPPFLAGS+= -DHEAP_START=0x20000 -DHEAP_LIMIT=0x50000
 SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_INCLUDE_NET=no
 
@@ -68,3 +65,6 @@
 .endif
 
 .include "../Makefile.booters"
+
+#CFLAGS= -O2 -fomit-frame-pointer -fno-defer-pop
+#CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-main
Index: sys/arch/i386/stand/biosboot_ser/Makefile
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/i386/stand/biosboot_ser/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- sys/arch/i386/stand/biosboot_ser/Makefile	2000/06/02 18:26:11	1.5
+++ sys/arch/i386/stand/biosboot_ser/Makefile	2000/09/22 20:31:35
@@ -31,12 +31,12 @@
 #set PRIM_LOADSZ to <=9 to make a 720k boot floppy (default: 15)
 #CPPFLAGS+= -DPRIM_LOADSZ=9
 
-#CFLAGS= -O2 -fomit-frame-pointer -fno-defer-pop
-CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-main
-
 SAMISCCPPFLAGS+= -DHEAP_START=0x10000 -DHEAP_LIMIT=0x40000
 SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_INCLUDE_NET=no
 
 VERSIONFILE= ${.CURDIR}/../biosboot/version
 
 .include "../Makefile.booters"
+
+#CFLAGS= -O2 -fomit-frame-pointer -fno-defer-pop
+#CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-main
Index: sys/arch/i386/stand/dosboot/Makefile
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/i386/stand/dosboot/Makefile,v
retrieving revision 1.16
diff -u -r1.16 Makefile
--- sys/arch/i386/stand/dosboot/Makefile	2000/09/05 05:05:16	1.16
+++ sys/arch/i386/stand/dosboot/Makefile	2000/09/22 20:33:57
@@ -16,9 +16,6 @@
 #uncomment if there are problems with memory detection
 #CPPFLAGS+= -DCONSERVATIVE_MEMDETECT
 
-#CFLAGS= -O2 -fomit-frame-pointer -fno-defer-pop
-CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-main
-
 # XXX should go into library
 SRCS+= getopt.c
 .PATH: ${.CURDIR}/../libsa
@@ -39,3 +36,6 @@
 .endif
 
 .include "../Makefile.booters"
+
+#CFLAGS= -O2 -fomit-frame-pointer -fno-defer-pop
+#CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-main
Index: sys/arch/i386/stand/netboot/Makefile
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/i386/stand/netboot/Makefile,v
retrieving revision 1.20
diff -u -r1.20 Makefile
--- sys/arch/i386/stand/netboot/Makefile	1999/04/08 10:23:23	1.20
+++ sys/arch/i386/stand/netboot/Makefile	2000/09/22 20:34:23
@@ -21,9 +21,6 @@
 #uncomment if there are problems with memory detection
 #CPPFLAGS+= -DCONSERVATIVE_MEMDETECT
 
-#CFLAGS= -O2 -fomit-frame-pointer -fno-defer-pop
-CFLAGS+= -Wall
-
 # XXX should go into library
 .PATH: ${.CURDIR}/../libsa
 SRCS+= nfs.c
@@ -70,5 +67,8 @@
 VERSIONFILE= ${.CURDIR}/version
 
 .include "../Makefile.booters"
+
+#CFLAGS= -O2 -fomit-frame-pointer -fno-defer-pop
+#CFLAGS+= -Wall
 
 conf.o dev_net.o: Makefile
>Release-Note:
>Audit-Trail:
>Unformatted: