removing unused functions during final link

Melvin Blades melvin.blades@gmail.com
Wed Aug 27 21:02:00 GMT 2014


I've inherited a pile of code and need to cross compile it for an
embedded MIPs processor
I'm creating a single app that will be run under Linux.
My  app  code links to another larger pile of  third-party software (utilities)
My app uses only  a  part of the these utilities, but the final
executable is very large and includes  utilities functions that are
never called.
My app also will dynamically link with uclibc

My compilation/linking results in an app so large that I can't load it
on my eval board.

What command line options can I use to get the linker to strip unused
functions from the final executable?

I've googled and came up with some proposed solutions

This one
        https://gcc.gnu.org/ml/gcc-help/2003-08/msg00128.html
results in an error message .. -f may not be used without -shared

Other places say that the dead-strip  option is architecture dependent.
http://embeddedfreak.wordpress.com/2009/02/10/removing-unused-functionsdead-codes-with-gccgnu-ld/
Where can I find out if the MIPS compiler supports this?
Or whether I just haven't used the correct command line options for
compiling and linking



More information about the Gcc-help mailing list