Fw: Does ld removes uncalled functions from final exe ?
Nick Clifton
nickc@redhat.com
Mon Sep 6 08:03:00 GMT 2004
Hi Valery,
> I wrote simple test program to discover wheter ld removes unreachable code.
The linker does not do this by default. To achieve the affect you want
compile your code with the -ffunction-sections switch specified and then
link with the -gc-sections switch. eg like this:
gcc -ffunction-sections -c test.c testfx.c
gcc -Wl,-gc-sections test.o testfx.o
Cheers
Nick
More information about the Binutils
mailing list