From owner-freebsd-current@FreeBSD.ORG Thu Dec 6 16:34:11 2007 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B53C516A418; Thu, 6 Dec 2007 16:34:11 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85]) by mx1.freebsd.org (Postfix) with ESMTP id 796B413C469; Thu, 6 Dec 2007 16:34:11 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1]) by dragon.nuxi.org (8.14.1/8.14.1) with ESMTP id lB6GY9x0038147; Thu, 6 Dec 2007 08:34:09 -0800 (PST) (envelope-from obrien@dragon.nuxi.org) Received: (from obrien@localhost) by dragon.nuxi.org (8.14.1/8.14.1/Submit) id lB6GY82f038146; Thu, 6 Dec 2007 08:34:08 -0800 (PST) (envelope-from obrien) Date: Thu, 6 Dec 2007 08:34:08 -0800 From: "David O'Brien" To: Alexander Leidinger Message-ID: <20071206163408.GA37676@dragon.NUXI.org> Mail-Followup-To: obrien@freebsd.org, Alexander Leidinger , Ruslan Ermilov , Boris Samorodov , Jan Lentfer , freebsd-current@freebsd.org References: <4756BAD3.4060905@web.de> <95938867@bb.ipt.ru> <20071205231628.GA15765@dragon.NUXI.org> <20071206072239.GA81748@team.vega.ru> <20071206084342.cv8xbmqg4k0co8kg@webmail.leidinger.net> MIME-Version: 1.0 Content-Type: text/plain; charset=unknown-8bit Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20071206084342.cv8xbmqg4k0co8kg@webmail.leidinger.net> X-Operating-System: FreeBSD 7.0-CURRENT User-Agent: Mutt/1.5.16 (2007-06-09) Cc: Boris Samorodov , Jan Lentfer , freebsd-current@freebsd.org Subject: Re: Problems Building 7.0-Beta3 with -Os X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@freebsd.org List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2007 16:34:11 -0000 Ruslan Ermilov (from Thu, 6 Dec 2007 10:22:39 wrote: >> In otherwords: -O1 < -Os < -O2 (properly) >> > I read it differently. From the manpage: > : -Os Optimize for size. -Os enables all -O2 optimizations that do not > : typically increase code size. It also performs further optimiza- > : tions designed to reduce code size. > > It says that -Os is a subset of -O2 optimizations plus some > extra optimizations. Reading further in a manpage, there's > only one, -mspace. Yeah, GCC 4.2 now adds a few things to -Os: sets optimize = 2, and remove from -O1: flag_tree_ch remove from -O2: flag_tree_pre } if (optimize_size)¶ {¶ align_loops = 1; align_jumps = 1; align_labels = 1;¶ align_functions = 1;¶ flag_reorder_blocks = 0;¶ flag_reorder_blocks_and_partition = 0;¶ /* Inlining of very small functions usually reduces total size. */¶ set_param_value ("max-inline-insns-single", 5);¶ set_param_value ("max-inline-insns-auto", 5);¶ flag_inline_functions = 1; // taken from -O3¶ /* We want to crossjump as much as possible. */¶ set_param_value ("min-crossjump-insns", 1); } On Thu, Dec 06, 2007 at 08:43:42AM +0100, Alexander Leidinger wrote: > And after the import of the new gcc in 7, a lot of people noticed, that > the resulting binaries are larger with -Os than with -O2. quynh:/usr/src/usr.bin/vi> uname -m amd64 quynh:/usr/src/usr.bin/vi> /bin/ls -l nvi.-O* -rwxr-xr-x 1 root ncvs 366894 Dec 6 08:21 nvi.-O2 -rwxr-xr-x 1 root ncvs 313043 Dec 6 08:21 nvi.-Os quynh:/usr/src/usr.bin/vi> size nvi.-O* text data bss dec hex filename 326132 1944 4392 332468 512b4 nvi.-O2 273759 1944 4392 280095 4461f nvi.-Os Perhaps you mean *sometimes* larger. Also -Os goal is run-time foot print, not disk foot print. -- -- David (obrien@FreeBSD.org)