Re: CONFIG_TINY

Tom Rini
2002-10-31T14:27:24Z

On Thu, Oct 31, 2002 at 12:33:10AM -0500, Mark Mielke wrote:
> On Wed, Oct 30, 2002 at 06:10:02PM -0700, Tom Rini wrote:
> > On Thu, Oct 31, 2002 at 01:53:14AM +0100, Adrian Bunk wrote:
> > > could you try to use "-Os" instead of "-O2" as gcc optimization option
> > > when CONFIG_TINY is enabled? Something like the following (completely
> > > untested) patch:
> > -Os can produce larger binaries, keep in mind. If we're going to go
> > this route, how about something generally useful, and allow for general
> > optimization level / additional CFLAGS to be added.
>
> Sure CFLAGS should be configurable, but CONFIG_TINY should always prefer
> -Os over -O2. From 'man gcc':
>
> -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.
>
> If gcc regularly generates larger code with -Os the answer is to talk to
> the gcc people, not to avoid using -Os...

It's not that it does regularly, it's that it can, and if it does, it's
not really a gcc bug from what I recall. So I don't think CONFIG_TINY
should prefer -Os over -O2 but instead we should just ask the user what
level of optimization they want. Remember, one of the real important
parts of embedded systems is flexibility.

--
Tom Rini (TR1265)