Date: Thu, 6 Dec 2007 08:34:08 -0800 From: "David O'Brien" <obrien@freebsd.org> To: Alexander Leidinger <Alexander@Leidinger.net> Cc: Boris Samorodov <bsam@ipt.ru>, Jan Lentfer <Jan.Lentfer@web.de>, freebsd-current@freebsd.org Subject: Re: Problems Building 7.0-Beta3 with -Os Message-ID: <20071206163408.GA37676@dragon.NUXI.org> In-Reply-To: <20071206084342.cv8xbmqg4k0co8kg@webmail.leidinger.net> References: <4756BAD3.4060905@web.de> <95938867@bb.ipt.ru> <20071205231628.GA15765@dragon.NUXI.org> <20071206072239.GA81748@team.vega.ru> <20071206084342.cv8xbmqg4k0co8kg@webmail.leidinger.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Ruslan Ermilov <ru@freebsd.org> (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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071206163408.GA37676>