2

I am following some Linux instructions on OS X and am stuck on one line:

strip -N main my_file.o

The OS X version of strip doesn't have an -N option and I've read through the man page twice but am just not sure how to do this.

So how do I strip a single name from the symbol table on OS X?

Lye Fish
  • 2,538
  • 15
  • 25

1 Answers1

1

As you say, the OSX version of strip doesn't allow this; the only way therefore is to limit its visibility in code using this on the declaration:

__attribute__((visibility("hidden"))) void MyFunction1();

Alternatively you could compile with -fvisibility=hidden and use "default" in the above __attribute__ to only expose the symbols you want.

This is a better approach anyway, as it does not require an external build step.

Note: I have found this doesn't work as expected when Objective-C code is introduced into the code base...

Reference

trojanfoe
  • 120,358
  • 21
  • 212
  • 242