This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Strip (or replace) Symbols from a Static Library

Hi,

I'm building a Static Library, using CCS 4.1 and want to strip/replace all symbols, except couple functions. So if somebody unarchives the library and disassembles the object, there are no function names (or junk function names, like: func001, func002, var001, var002, ...). 

Is there any simpler then manual way to do this? 

PS: Library consists of ~15 objects and there are no way to define everything as static.

Thanks!

 

  • Thanks Ki,

    I tried it, it strips/hides symbol information pretty good. But here is a question:

    But, here is what I have: library that consists of o1 and o2 object , I stripped/hide all symbols from o1.obj, and all except 1 (that I want to make "public") from o2.obj. Also o2.obj have calls to o1.obj, How the linker (later when building a binary) would know where to link this call (o1.obj got completely stripped)? 

    It almost looks like I need a tool that will rename all symbols (except couple that I want to share) to some generic names, like func1, func2, var1, var2, etc. 

    Any ideas?

  • mmaaxx,

    I'll move this to the Compiler forum, where there is more expertise on this fetaure.

    Thanks

    ki

  • Thanks Ki, here is what I end up doing (just want to share a solution if somebody would have same problem):

    1. Using nm utility, created a list of symbols in all objects.

    2. Manually edited it (removed some "internal" and symbols that I want to keep untouched).

    3. Created a script took a file with the list of symbols and created obfuscate.h, that looks like: 

     

    #ifdef OBFUSCATE
    #define  MyRealFunctionName  SYM0
    #define  MyRealFunctionName  SYM1
    #define  MyRealFunctionName  SYM2
    ....
    So, when I'm building with OBFUSCATE defined, the preprocessor replaces real, nice symbol names to SYMX.
    -Max