removing unused functions during final link
Melvin Blades
melvin.blades@gmail.com
Wed Sep 3 03:20:00 GMT 2014
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@google.com> wrote:
> On Wed, Aug 27, 2014 at 2:02 PM, Melvin Blades <melvin.blades@gmail.com> 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
More information about the Gcc-help
mailing list