4

In a static library project for iOS 6, some functions in a .c file is referenced by others, and therefore are considered global symbols, but should not be exposed to the user of this library.

How can I strip these function names out? Also, how can I hide those obj file names as well so that nobody could see the .o names in nm output?

I have tried to enable/set:

  • Deployment Postprocessing
  • Strip Debug Symbols During Copy
  • Strip Linked Product
  • Strip Stype: either 'Non-Global Symbols' or 'Debugging symbols'
  • Use Separate Strip

EDIT:

I see that there is another Build Setting item 'Additional Strip Flags'. By adding in it a flag -R /path/to/symbol_list_file, strip command would remove symbols indicated in the file, or -s /path/to/exported_symbol_list_file -u to indicate interfaces and leaving undefined symbols at the same time.

ZhangChn
  • 3,154
  • 21
  • 41

1 Answers1

3

No, you can't. A static library is simply a collection of object files and the object files within the static library have no special privileges over those using the static library.

You can obviously strip the final binary.

If you must hide symbols then they need to be static, which forces you to use fewer implementations files to allow the symbol to be shared, which is inconvenient.

trojanfoe
  • 120,358
  • 21
  • 212
  • 242
  • What can I do to hide implementation details/linkage info like the paths of .o files from 3rd party clients of my static lib? Could it be obfuscated, at least in Release builds? – ZhangChn Sep 14 '13 at 18:04
  • @ZhangChn Well the only way I can think of is to put all the implementation (or at least the stuff you want to protect) into a single `.o` file within the library. That's a bit rubbish, but please tell me what you are trying to hide and why? – trojanfoe Sep 14 '13 at 19:31