[Top][All Lists]

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

Re: [avr-libc-dev] Question on Optimizations with Linking

From: Russell Shaw
Subject: Re: [avr-libc-dev] Question on Optimizations with Linking
Date: Fri, 25 Nov 2005 11:35:54 +1100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.11) Gecko/20050914 Debian/1.7.11-1

Paulo Marques wrote:
Paul Schlie wrote:

From: Russell Shaw <address@hidden>
I had the idea that instead of having single large libraries such as
stdio and libm, they could be made of say a dozen parts (even one per
large function) with reduced or enhanced implementations of various
functions, so rom spaced isn't filled with unused code. The default
linking could use a standard stdio or libm. It might not be worth
doing for things that are easily done in C by the user.

I might be missing something here, but isn't this what -ffunction-sections and -fdata-sections compiler options combined with --gc-sections linker option are supposed to do?

Are there any drawbacks of using this, like worse optimization, etc.? Or is this not working at all for avr?

info gcc:

     Place each function or data item into its own section in the output
     file if the target supports arbitrary sections.  The name of the
     function or the name of the data item determines the section's name
     in the output file.

     Use these options on systems where the linker can perform
     optimizations to improve locality of reference in the instruction
     space.  Most systems using the ELF object format and SPARC
     processors running Solaris 2 have linkers with such optimizations.
     AIX may have these optimizations in the future.

     Only use these options when there are significant benefits from
     doing so.  When you specify these options, the assembler and
     linker will create larger object and executable files and will
     also be slower.  You will not be able to use `gprof' on all
     systems if you specify this option and you may have problems with
     debugging if you specify both this option and `-g'.

info ld:

     Enable garbage collection of unused input sections.  It is ignored
     on targets that do not support this option.  This option is not
     compatible with `-r'. The default behaviour (of not performing
     this garbage collection) can be restored by specifying
     `--no-gc-sections' on the command line.

It depends on whether this feature is implemented in the avr tools.
(Don't know if it is or not)

reply via email to

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