Subject: Re: bootxx_ffs maximum load size exceeded
To: Simon Burge <simonb@wasabisystems.com>
From: James Chacon <jmc@NetBSD.org>
List: port-alpha
Date: 12/24/2004 13:35:20
On Sat, Dec 25, 2004 at 12:12:49AM +1100, Simon Burge wrote:
> On Fri, Dec 24, 2004 at 11:53:06AM +1100, Simon Burge wrote:
> 
> > Paul Mather wrote:
> > 
> > > I run NetBSD/alpha 2.0E-CURRENT, last completely rebuilt back in May.  I
> > > thought I'd do another build.sh complete rebuild after cvs
> > > updating /usr/src a day or so ago.  Unfortunately, the build stops,
> > > complaining "checking sizes for bootxx_ffs/bootxx_ffs.sym... MAXIMUM
> > > LOAD SIZE EXCEEDED (7832 > 7680)".
> > > 
> > > Is anyone else seeing this?  Is there anything I can do to eliminate
> > > this error?
> > > 
> > > I've included at the end the latter part of the build.sh log.
> > 
> > This is a known problem - a quick look at the PR database didn't show
> > anything up though.  There's an extra section (a debug section? - I
> > can't recall) that newer binutils adds, and we need to work out how to
> > remove it.
> 
> The attached patch is pretty gross, but at least allows bootxx_ffs
> to build.  bootxx_lfs is still too big, so I've disabled the
> building of that for now.  I'm not sure if anyone actually uses
> bootxx_lfs?  I did test it once ages ago when I was playing around with
> boot-off-LFS-on-raidframe.  Note that I haven't tested the resultant
> bootxx_ffs yet - my alphas are turned off right now.
> 
> Should I commit this so as to at least allow builds to work again?  If
> so, I'd also add a doc/HACKS entry too.  I'm also asking the binutils
> folks what we can do about this.

Let's try this one instead. Less hacky overall I think and w. it all boot
blocks build again (basically we're back to the same outputs as binutils 2.14
I beleive)

When we were experimenting on icb w. this we were trying to strip eh_frame
out after linking. That doesn't work as it's already part of the text segment
so it just pads back out when we objcopy into binary form. This makes sure
no objects have the section and the linker happily makes smaller binaries then.

The only oddity was forcing libsa/etc to pick it up, or else bootxx_lfs was
still too large. 

James

Index: Makefile.bootprogs
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/stand/Makefile.bootprogs,v
retrieving revision 1.24
diff -u -r1.24 Makefile.bootprogs
--- Makefile.bootprogs	26 Oct 2003 07:25:35 -0000	1.24
+++ Makefile.bootprogs	24 Dec 2004 19:32:30 -0000
@@ -124,16 +124,18 @@
 
 ### find out what to use for libkern
 KERN_AS=	library
+KERNMISCMAKEFLAGS+=-f ${.CURDIR}/../Makefile.inc
 .include "${S}/lib/libkern/Makefile.inc"
 LIBKERN=	${KERNLIB}
 
 ### find out what to use for libz
 Z_AS=		library
+ZMISCMAKEFLAGS+=-f ${.CURDIR}/../Makefile.inc
 .include "${S}/lib/libz/Makefile.inc"
 LIBZ=		${ZLIB}
 
 ### find out what to use for libsa
 SA_AS=		library
-SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
+SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes -f ${.CURDIR}/../Makefile.inc
 .include "${S}/lib/libsa/Makefile.inc"
 LIBSA=		${SALIB}
Index: Makefile.inc
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/stand/Makefile.inc,v
retrieving revision 1.19
diff -u -r1.19 Makefile.inc
--- Makefile.inc	27 Aug 2002 08:53:14 -0000	1.19
+++ Makefile.inc	24 Dec 2004 19:32:30 -0000
@@ -9,3 +9,14 @@
 
 CPPFLAGS+=		-I${.CURDIR}/../..
 LDSTATIC=		-static
+
+# binutils 2.15 forces a .eh_frame section into all objects. Nuke it for space
+.c.o:
+	${COMPILE.c} ${.IMPSRC}
+	${OBJCOPY} -R .eh_frame ${.PREFIX}.o 
+.S.o:
+	${COMPILE.S} ${.IMPSRC}
+	${OBJCOPY} -R .eh_frame ${.PREFIX}.o 
+.s.o:
+	${COMPILE.s} ${.IMPSRC}
+	${OBJCOPY} -R .eh_frame ${.PREFIX}.o