"Dr. Torsten Rupp" <rupp@xxxxxxxxx> 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