This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fw: Does ld removes uncalled functions from final exe ?


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]