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