avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Re: Removal of unused functions


From: David Brown
Subject: Re: [avr-gcc-list] Re: Removal of unused functions
Date: Tue, 22 Aug 2006 12:27:27 +0200
User-agent: Thunderbird 1.5.0.5 (Windows/20060719)

Johannes Bauer wrote:
Björn Haase wrote:
Hello people,

I've read quite a bit about the removal of unused functions when using
avr-gcc. In particular I've read Jörg's remarks about the automatic
removal feature being useless and I think this might very well be
correct.
Joerg's statement used to be correct but no longer is. In fact there was a problem for older versions of binutils. The problem that you have encountered is fixed in the most recent cvs version of the binutils. If you don't know how to use cvs, you might use some recent snapshot.

Thank you, I've switched to the CVS version of binutils and everything
works as expected now.

He also made a remark about the feature being hardly maintained and that it might break with future versions of GCC - this again might
hold true (if I'm not making something wrong).
I don't consider it to be hardly maintained and I don't see any problem that might show up with future versions of gcc.

Cool. I consider it to be a neat, useful feature: Not only can you by
split up libraries by function, not by functions - you can also use it
to track where in your program is code you've never used. Excellent.

Splitting up a library into many C-files for every C-function is a bad
idea IMHO - splitting up into many C-files which have the same semantic
and are related to each other is a good idea IMHO. I don't see why the
code for a free() should be included in my final binary when I use
malloc() - however, as malloc() and free() are closely related I believe
it makes a lot of sense to pack them into one C-file.

, but that's a feature (removal of unused global static variables) where I have strong reasons to expect it to work, but that I never tried myself.

I'll use that just for tracking. Global static variables which are
unsued should'nt ever happen I think. At least in my code they don't ;-)

That's exactly what I happens for older versions of avr-ld version that do not include my fix for --gc-sections.

Fixed in the CVS! :-)

Thanks for your help!
Greetings,
Johannes


Won't the use of program-at-once compilation give you better results than just eliminating unused functions? I haven't done much avr work for a while, and haven't tried out 4.2 at all, but it sounds to me like it is the optimal solution for programs that are small enough for the compilation to run quickly. program-at-once compilation will automatically eliminate unused functions and data, and will additionally allow better optimisation for remaining functions (such as inlining any function that is only used once).


mvh.,

David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]