Gentoo Archives: gentoo-user

From: Mike Edenfield <kutulu@××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] -Os = Nono?
Date: Mon, 23 Jul 2007 19:10:36
Message-Id: 46A4FBEF.2060409@kutulu.org
In Reply to: Re: [gentoo-user] -Os = Nono? by Kenneth Prugh
1 Kenneth Prugh wrote:
2 > Volker Armin Hemmann wrote:
3 >> On Montag, 23. Juli 2007, Alexander Skwar wrote:
4 >>> Volker Armin Hemmann <volker.armin.hemmann@××××××××××××.de> wrote:
5 >>>> And then Os. That is a big nono.
6 >>> Why's that?
7 >>>
8 >>> Alexander Skwar
9 >> because several gcc have compiled crap with that flag in the past?
10 >>
11 >>
12 >
13 > That was the past, -Os generally works fine on AMD64 now. That can be
14 > evidenced by my fully -Os built system that works fine.
15
16 From my experience, the main "problem" with -Os is that it's rarely
17 used, and not all that useful. It's essentially the same as -O2 with
18 some optimizations turned off, to save space. The difference in binary
19 size between -O2 and -Os has no, in my experience, been very
20 significant. And -Os produces slower code than -O2.
21
22 More importantly, -O2 seems to be the "typical" optimization setting,
23 and almost all free software packages are built and tested and generally
24 "supported", for whatever that means in an open-source world, under -O2.
25 If you report a bug in a package and you use -Os, the first thing the
26 devs will ask is "recompile it using normal CFLAGS and try again."
27
28 So yes, recent gcc versions have been much better at not breaking code
29 under -Os. At least, it's no more broken under -Os than under -O2. But
30 given that disk space is dirt cheap and modern OS don't need to read
31 an entire binary into memory to execute it, the actual, tangible
32 benefits of using -Os over -O2 are minimal compared against the possible
33 problems it might cause.
34
35 --Mike
36 --
37 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] -Os = Nono? Benno Schulenberg <benno.schulenberg@×××××.com>