Graham Stott wrote: >It is possible to eliminated unused functions on many but not all targets >supported by GCC. >Use -ffunction-sections when compling and and --gc-sections when linking. I apologise then. I tried to simulate this on SunOS 5.8. Wonder if someone can help me with an ld warning I encountered which seems to be the reason for my corrupted executable. Three C source files: $> cat hello.c int main(void) { printf("\nHello world!\n"); func1(); exit(0); } $> $> cat fun1.c void func1(void) { printf("\nIn function func1()\n"); } void func2(void) { func3(); } $> $> cat fun2.c void func3(void) { printf("\nIn function func3()\n"); } $> Compiled with gcc <gcc version 3.3> $> $>gcc -ffunction-sections -pedantic-errors -c *.c $> Linked with ld <GNU ld version 2.11.2 (with BFD 2.11.2)> $> ld --gc-sections *.o /bin/ld: warning: cannot find entry symbol _start; not setting start address $> And my a.out is corrupted: $> file a.out can't read ELF header a.out: $> And dumps core: $> ./a.out Segmentation fault (core dumped) $> Why/how do I have to speficiy the start address? I did see http://www.gnu.org/software/binutils/manual/ld-2.9.1/html_node/ld_24.htm l#SEC24 - am none the wiser. Help! Cheers, Srikanth Madani