This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Symbols which were not used, still in binary


Steve Kreyer wrote:

> I have compiled the follwing code with the command ''gcc file.c''
>
> ...
> 
> Neither is it used in this piece of code, nor is it compiled into an
> object file,
> so in my opinion it should be optimized away by gcc.
> So perhaps anybody can tell me whats wrong with my thought...

First of all, if you just type "gcc file.c" then you have not enabled
any optimization at all.  You have to supply -O2 (or -Os, -O1, etc.) if
you want the compiler to perform optimization, as the default is -O0.

That aside, the function won't be eliminated until it's declared
"static", as some other module could still call it.

Brian


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