title: How to remove symbols from .so file during build
body: <p>I am using VS-android framework to compile Android shared object directly from Microsoft Visual Studio 2012 + Android NDK.
  I disassembled my own .so file using IDA and was horrified to see that all my code is completely visible (names of the functions, names of the data buffers, names of classes, etc).</p>
  
  <p>I want to remove all that debug and unneeded symbols so it would be hard to understand my code by disassembling it.</p>
  
  <p>The compilation process is as following:</p>
  
  <ol>
  <li>I have 10 C++ files. Each is compiled to an .o file</li>
  <li>main_service.c is than compiled to main.o and linked against all the other *.o files to yield main_service.so library.</li>
  </ol>
  
  <p>I have tried the following solutions and they didn't work:</p>
  
  <ol>
  <li>Giving argument -strip-all to the compiler and to the linker. It does not seem to work.</li>
  <li>After linking, call objcopy.exe with -strip-all on main_service.o. This reduces a bit the size of main_serivce.so but the symbols remain</li>
  <li>In my C++ code I never use "<strong>attribute</strong> ((visibility()))" so maybe the problem is that linker cannot remove symbols because it does not know what is private and can be hidden and what is public.   I tried to add "<strong>attribute</strong> ((visibility("default")))" to the functions in main_service.c which I want to use in JNI and added -fvisibility=hidden flags to the compiler and the linker. But I got a warning : 'visibility' attribute ignored [-Wattributes], and the symbols are not removed</li>
  </ol>
  
  <p>What am I missing here?</p>
  
  <p>P.s. - I am completely new to "stripping symbols" so sorry if my question is a bit silly.</p>
  
  <p>-</p>