GCC (ld) option to strip unreferenced data/functions
Posted
by legends2k
on Stack Overflow
See other posts from Stack Overflow
or by legends2k
Published on 2010-05-21T12:48:51Z
Indexed on
2010/05/21
12:50 UTC
Read the original article
Hit count: 407
I've written an program which uses a library which has numerous functuions, but I only limited functions from it. GCC is the compiler I use. Once I've created a binary, when I used nm
to see the symbols in it, it shows all the unwanted (unreferenced) functions which are never used. How do I removed those unreferenced functions and data from the executable?
Is the -s
option right? I'm tols that it strips all symbol table and relocation data from the binary, but does this remove the function and data too? I'm not sure on how to verify this too, since after using -s
nm doesn't work since it's stripped all sym. table data too.
© Stack Overflow or respective owner