Ruslan Ermilov <ru_at_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_at_FreeBSD.org)Received on Thu Dec 06 2007 - 15:34:11 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:23 UTC