Fw: Does ld removes uncalled functions from final exe ?
Valery Pykhtin
pykhtin@prosoft.ural.ru
Mon Sep 6 07:23:00 GMT 2004
Hi all,
I wrote simple test program to discover wheter ld removes unreachable code.
test.c
int main(blablabla)
{
return 0;
}
testfx.c
int fx(int a)
{
a += random(); // a lot of reps of this line
....
return a;
}
Than I tried to link these files into .exe and discovered no difference in
size when I call fx from main or not. However if I removed testfx.c from
makefile, the size of exe became smaller.
I've tried some options to linker such as -O, -x, -s but nothing helps.
Can anyone give some comments to this ?
Very thanks
More information about the Binutils
mailing list