I\'m trying to link in all unreferenced symbols from a few static libraries (my own libraries) for my C++ xcode app. I have tried all the properties related to \'strip\' (by
The standard linking mechanism - i.e. using the -l
option to link a .a
file will intelligently filter out object files that are not used, so the reason why the symbols are not present in the resultant binary is that they're not actually linked in.
If you want to get all the symbols from one archive, you can use the flag: -force_load libraryarchive
, used like: -Wl,-force_load,libfoobar.a
where libfoobar.a
is the archive that you want to get all the symbols from.
In order to get all the symbols from the all archives, you should use the linker flag: -all_load
, or if you're driving it from gcc
/clang
the flag -Wl,-all_load
.
It produces hideous symbol tables, though!