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

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

Re: [avr-gcc-list] Linker optimization


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] Linker optimization
Date: Wed, 26 Jun 2002 17:28:55 +0200 (MET DST)

Bob Hansen <address@hidden> wrote:

> Is there some linker flag that I should be including to tell the
> linker to ditch any unused functions?

Nope.  You have two options:

Mark all functions as "static".  If they are unused within the file,
the compiler will tell you provided you use some form of optimzation,
and have an appropriate warning level enabled (like -Wall).  For
non-static functions it cannot tell you since it must assume they are
meant to be called from other modules.

Put each of the candidate functions into a source file of its own,
compile them into .o files, and use avr-ar to produce an archive of
object modules (filename ending in .a).  Then, on the linker command
line, use the name of this archive file (after all your .o files).
The linker will only pull out those object modules from the archive
that are needed to resolve undefined external references.  (It might
be necessary to run avr-ranlib on the .a file after adding modules,
i'm not sure about this right now.)

-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/
avr-gcc-list at http://avr1.org



reply via email to

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