问题
I'm trying to strip my mac os x application of all unneeded symbols. If I do this on my linux app using "--strip-unneeded" the symbol table on my application is empty and returns nothing.
On Mac OS X, I am seeing symbols related to the typeinfo and vtable entries for my classes, as well as some function. As best as I can tell, this is happening on the functions defined in headers and marked inline. Undefined functions coming from external libraries are present in the nm output, but marked with "U".
strip -u -r myapp does not seem to remove them.
Trying to put them in a remove file and doing: strip -u -r -R remove_file.txt myapp
doesn't work either. This is a monolithic binary whose only shared library dependencies are on corefoundation and the veclib frameworks.
Any suggestions please?
回答1:
Don't have a definite solution (I'm still in the process of learning C++ (and Objective C++) and learning to deal with this stuff myself) but you could look over:
Visibility of Inline Functions
and
Technical Note TN2185: C++ Tips and Tricks for Mac OS X
What's the current setting for "Inline Methods Hidden"? (Double-click on the target in the Groups & Files column, switch to Build tab, scroll down to Code Generation, or it's this setting:
[GCC_INLINES_ARE_PRIVATE_EXTERN, -fvisibility-inlines-hidden] "When enabled, out-of-line copies of inline methods are declared 'private extern'". )
来源:https://stackoverflow.com/questions/4236525/cant-strip-all-unneeded-symbols-on-a-mac-os-x-c-application