This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Removing unused functions/dead code
- From: LLeweLLyn Reese <llewelly at lifesupport dot shutdown dot com>
- To: "Dr. Torsten Rupp" <rupp at aicas dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 10 Aug 2003 19:04:55 -0700
- Subject: Re: Removing unused functions/dead code
- References: <3F336D91.7050302@aicas.com>
"Dr. Torsten Rupp" <rupp@aicas.com> writes:
> Hi,
>
> I have a question concerning removing unused functions/dead code. I
> could not find any hint to this in the gcc documentation.
>
> I created with gcc and ar a library containing object files with
> many functions. When I link the library either with gcc or ld to
> a compiled application all functions of an object file in the
> library a linked to the application, even only a single independant
> function from an object file is needed. Is it possible with
> gcc/ld to remove unused function when the application is linked?
> For me is looks like it should be possible in the case when no
> reference to an unused function exists (which is the definition of
> unsed).
See -ffunction-sections at:
http://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Optimize-Options.html#Optimize%20Options