Using gcc instead of ld, I was able to get it to strip unused functions if all the functions in a file are not called. But I could not get it to strip unused functions if they are in the same source file as used functions . Is there a way to get it strip ALL the unused functions? Thanks for any hints, I'm running out of things to try On Wed, Aug 27, 2014 at 2:22 PM, Ian Lance Taylor <iant@xxxxxxxxxx> wrote: > On Wed, Aug 27, 2014 at 2:02 PM, Melvin Blades <melvin.blades@xxxxxxxxx> wrote: >> >> What command line options can I use to get the linker to strip unused >> functions from the final executable? > > Compile with -ffunction-sections -fdata-sections. > > Link with -Wl,--gc-sections. > > Ian