Date: Wed, 13 Sep 2006 11:08:48 -0600 (MDT) From: "M. Warner Losh" <imp@bsdimp.com> To: freebsd-arm@FreeBSD.org Subject: Re: -O2 optimization Message-ID: <20060913.110848.-311941144.imp@bsdimp.com> In-Reply-To: <20060911163218.GA88778@dragon.NUXI.org> References: <20060911163218.GA88778@dragon.NUXI.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20060911163218.GA88778@dragon.NUXI.org> "David O'Brien" <obrien@FreeBSD.org> writes: : I've been wondering. Since most ARM platforms are RAM and storage : limited, should we not compile with -O2 and use -Os instead. : : -Os is "Optimize for size. -Os enables all -O2 optimizations that do not : typically increase code size. It also performs further optimizations : designed to reduce code size". : : So what do folks think about this patch? I like the idea, but I'm not sure I like the testing of MACHINE_ARCH directly for this. Maybe something like OPT_SMALL being defined instead? However, the following change saved ~65kB in a ~1900kB kernel I just built, or about 3%. That seems signficant enough to me to have a knob for. : Index: kern.pre.mk : =================================================================== : RCS file: /home/ncvs/src/sys/conf/kern.pre.mk,v : retrieving revision 1.76 : diff -u -p -r1.76 kern.pre.mk : --- kern.pre.mk 17 Jul 2006 18:43:16 -0000 1.76 : +++ kern.pre.mk 11 Sep 2006 16:29:47 -0000 : @@ -27,7 +27,11 @@ COPTFLAGS?= -O : . if defined(DEBUG) : _MINUS_O= -O : . else : +. if ${MACHINE_ARCH} == "arm" : +_MINUS_O= -Os : +. else : _MINUS_O= -O2 : +. endif : . endif : . if ${MACHINE_ARCH} == "amd64" : COPTFLAGS?=-O2 -frename-registers -pipe : : -- : -- David (obrien@FreeBSD.org) : Q: Because it reverses the logical flow of conversation. : A: Why is top-posting (putting a reply at the top of the message) frowned upon? : _______________________________________________ : freebsd-arm@freebsd.org mailing list : http://lists.freebsd.org/mailman/listinfo/freebsd-arm : To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org" : :
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060913.110848.-311941144.imp>