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.

CCS: Hiding Symbols for Static Library Release

Tool/software: Code Composer Studio

I want to release one algorithm library in static library. Is there any possibility that I can hide the symbols(e.g. function name, global variable) in .obj file or final archived .lib file? Basically, I want to prevent prevent decompilation for my lib.

Below are what I investigated, but not fulfill my requirement. 

1. -O,--opt_level[=off,0,1,2,3], may help in some level, but not hide the symbol.

2. --visibility=hidden, this works for final linked excitable file, not work for static library.

Is there any such option for cl6x or ar6x?

  • Hello,

    The first thing to try is to disable symbol generation in the compiler options:

    Also see section 10.4 of the below user's guide:

    http://www.ti.com/lit/ug/spru186w/spru186w.pdf

    Thanks

    ki

  • Thanks. This is quite helpful. With "--symdebug:none" or strip6x, my object file size is dramatically reduced, plus, the symbol has less occurrence. However, there are still some readable symbol existing in the obj file. Can they disappear also?
    Secondly, what's the difference between "--symdebug:none" or strip6x? Could you help me to understand. I notice that "--symdebug:none" generated file has little smaller size than strip6x.
  • I recommend you become familiar with all the utilities described in C6000 assembly tools manual chapter titled Object File Utilities.  You have already used the strip utility.  The other utilities show you what remains in your object files.  

    PapaDog said:
    However, there are still some readable symbol existing in the obj file. Can they disappear also?

    No.  Then it would be impossible to link the file into the end user application.

    PapaDog said:
    Secondly, what's the difference between "--symdebug:none" or strip6x?

    They do a similar task differently.  They are not identical.  To understand them better, experiment.  Use each one, then inspect the object files with the utilities ofd6x, nm6x, and dis6x.  Yet another idea: Use both!

    Consider using a code obfuscation tool.  Such a tool could obscure all the symbol names except the ones you intend to expose to the end user application.

    Thanks and regards,

    -George

  • Thanks George,

    George Mock said:

    No.  Then it would be impossible to link the file into the end user application.

    I understand that. My thinking is that we only keep some exported symbols to end user in the obj or static lib. 

    George Mock said:

    Consider using a code obfuscation tool.  Such a tool c...

    Yes, that is good alternative.

    As TI experts, do you see the possibility that decompile the static lib or obj file into readable C++ code in my case? I am wondering the effort may not that worthy if no worry about decompilation of cl6x. 

  • PapaDog said:
    do you see the possibility that decompile the static lib or obj file into readable C++ code in my case?

    It is possible.  That said, it requires a non-trivial amount of work by someone with a fair amount of expertise.  How likely is that to happen?  I don't know.

    Thanks and regards,

    -George