This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: -g and -O2


The Chazman <chaz@devastator.extern.ucsd.edu> writes:

> Does throwing -g on the gcc command line affect optimization in any way?
> Is there any reason at all not to use -g even in release builds of
> embedded code where only the .text and .data sections will get burned
> into flash anyway?  Thanks for your thoughts...

Object code is supposed to be invariant wrt. `-g', but in practice
this is sometimes untrue because of bugs.  E.g., for MIPS, the
presence of extra labels to mark line numbers inhibits some delay-slot
optimizations.  The haifa scheduler has a bug where the presence of
line-number notes inflates complexity metrics and causes the scheduler
to consider code "too complex".

The presence of such bugs is strong justification to always compile
with `-g', so that you don't get caught building release code without
`-g', trusting that you can later compile the release sources with `-g'
and get exactly the same result.  Sadly, the Ascend router code is so
large, is ported to so many platforms, and each platform gets built so
many different ways that it is impractical for space reasons to always
compile with `-g', lest the space required to build a full release jump
from 2 GB (!) to 50..100 GB.

Soooo, if you have the disk space, then you should always compile
everything with `-g', and don't sweat the tiny bug-induced
non-optimalities that happen for some targets on some code.

Greg

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]