------- Comment #10 from mark at codesourcery dot com 2006-04-30 16:50 ------- Subject: Re: no static definition at -O0
hubicka at gcc dot gnu dot org wrote: > I don't quite see reason for outputting unneeded static functions even at -O0 > that it mostly just slows down the compilation process, but I am testing patch > that makes cgraph believe that every function passed to it should be output > unless it is extern inline and will post it for consideration once testing > converge. The reason for emitting all static functions at -O0 is that, historically, most compilers have done that. People tend to call these functions from the debugger. Of course, in GCC, we have attributes to say that a function should be kept, even though it's static, but some other compilers don't, so people tend to rely on the fact that these functions are emitted when optimization is disabled. We could document that GCC no longer keeps static functions at -O0. As you say, dropping these functions should improve compile times, although we don't really know by how much. My guess would be that there aren't very many unnecessary static functions. Please do be careful that your patch doesn't cause cgraph to emit all COMDAT functions. COMDAT functions (or weak/linkonce) functions should not be emitted at -O0, if they are not needed, because there tend to be *tons* of them; that would probably impact compile-time a lot. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24561