[MacPorts] #38218: default configure.optflags should be -Os rather than -O2

MacPorts noreply at macports.org
Wed Feb 27 15:36:09 PST 2013


#38218: default configure.optflags should be -Os rather than -O2
--------------------------+--------------------------------
  Reporter:  jeremyhu@…   |      Owner:  macports-tickets@…
      Type:  enhancement  |     Status:  closed
  Priority:  Normal       |  Milestone:  MacPorts Future
 Component:  base         |    Version:  2.1.3
Resolution:  fixed        |   Keywords:
      Port:               |
--------------------------+--------------------------------

Comment (by raimue@…):

 Replying to [ticket:38218 jeremyhu@…]:
 > All the kids are doing it.  -Os will result in smaller text allowing for
 more optimal use of spacial locality in the text cache.

 I am not opposed to the change, but I just can't leave that statement
 uncommented :-)

 I don't think `-Os` is always the better choice under all circumstances.
 There was a recent discussion on enabling [http://lwn.net/Articles/534735/
 -Os for the Linux kernel] and it was turned down, although that is about
 gcc whereas we are mostly using clang now.

 For clang the man page states:
 {{{
 -Os is like -O2 with extra optimizations to reduce code size.
 }}}
 I would say this is misleading. `-Os` is like `-O2`, but excludes
 optimizations that would cause the code size to grow. For example, it
 might disable inlining for larger functions and therefore, code locality
 can actually be decreased by `-Os`.

-- 
Ticket URL: <https://trac.macports.org/ticket/38218#comment:12>
MacPorts <http://www.macports.org/>
Ports system for Mac OS


More information about the macports-tickets mailing list