Reputation: 15788
I'm building a shared library that contains a public interface found some object file public.o
The shared library is composed of 100+ other objects files and I want to minimize the size if the .so file. Is there a way to remove of all the symbols from from the shared library that are not referenced by public.o? Alternatively, is there a way to retain only dependencies of extern "C" functions, stripping all of the unused C++ names?
Upvotes: 3
Views: 2920
Reputation: 1
You might use a recent GCC (e.g. a 4.6.1 version) and pass -flto
at compile and at (library) link time.
(added) You could also play with the visibility attribute.
But I won't bother about the size of an *.so
Upvotes: 1
Reputation: 9404
Look at this manual:
http://gcc.gnu.org/wiki/Visibility
it explains for example how to handle C++ names stuff.
Upvotes: 2