how to disable C++ dead code stripping in xcode

前端 未结 1 461
别那么骄傲
别那么骄傲 2021-01-03 03:52

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

相关标签:
1条回答
  • 2021-01-03 03:59

    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!

    0 讨论(0)
提交回复
热议问题