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.
Hello,
i'm building an relocatable out file with make_static linker option.
I use the stript tool to strip object files before linking but the global variables e.g. will retain in the obj files (for link step of course).
When i try to use the strip tool after linking on out file without option -p all the symbols of global variables retain. wiht option -p all symbols needed for final link step are removed too.
Is there anything I can do to remove static symbols from out file?
Is there any option to rename symbole names like "function1" or "Glb_Variable1" etc.?
Thanks a lot,
Tom
What is the overarching problem you are trying to solve? I suspect discussing your problem at that level will make it much easier to find a solution. In the meantime, this wiki article might be useful.
Thanks and regards,
-George
Hello George,
the idea is to provide a relocatable library to a different company to include our software parts into their hardware. Therefore I want to hide as much as possible.
Hope that helps understanding the problem.
Best regards,
Tom
I apologize for the delay.
You want to provide an object library to your customers, but you want to protect the intellectual property (IP) you have in that library. There is not one well defined way to accomplish that.
First off, please disregard my earlier post. That wiki article talks about managing symbols when you link. But you are providing an object library. That is an input to the linker, thus none of the techniques discussed in that article apply.
You do not say which TI processor family you are using. From one clue (compiler version 4.4.x) my guess is you are using ARM (TMS470) processors.
First, I want to show you how you can see how much IP you are exposing to your customers. The tools for seeing what is in an object library (or even a single object file) are the name utility and the object file display (OFD) utility. These tools are part of the ARM compiler toolset. The executables are named nm470 (name utility) and ofd470 (OFD utility). (Yet another parenthetical ... Starting with release 5.0.0, these tools change names to armnm and armofd.) You can read about them in the ARM assembly language tools book.
So, after applying any of the the methods I discuss for obscuring IP, you need to run nm470 and ofd470 on your library, and judge for yourself whether your IP is adequately protected.
% nm470 your.lib
% ofd470 -g your.lib # -g shows the debug information too
I recommend you not build your code with -g, but use --symdebug:none instead. This means your object code will never contain debug information. This also means that you and your customer will not be able to debug, or even profile, your code.
You mention using the strip utility. You could use that as an alternative to --symdebug:none. I don't think you will notice any difference, but you might. Since you are providing an object library that is linked into your customer's system, you cannot use the -p option. That would make your library unusable by the linker.
There are several kinds of symbols (i.e. the names of functions and data) in your library. I only discuss the global ones here. There are two cases to consider. Some global symbols you have to provide to your customer. They form your documented application programmer interface (API). Global symbols can also arise whenever you have functions or data shared across files that are not part of your API. The best way to get rid of those symbols is to reorganize your code so that these symbols are no longer shared across files, and thus can be changed to static. If that is not practical, or somehow insufficient, I recommend you perform an internet search on code obfuscation software.
Thanks and regards,
-George
Hi George,
Can we use partial linking to solve this problem ? while partial linking we can define what are the symbols we want to expose. Recently I was required to hide all unnecessary symbols from a library, and through googling I found that partial linking can help here.
Please help here, as I might be going in wrong direction/
Regards
Deepak Poddar
I apologize for the delay.
Using partial linking in this manner has been done. I recommend the library method because it is much more simple.
Some things to watch out for ...
Compile your code with the switch --gen_func_subsections. If you don't, then your final customer system will probably include space for functions from your library that are never called.
If you are building for EABI, then you should see this thread.
It appears you already know how to use the linker to manage your symbols. If not, this wiki article is helpful.
Thanks and regards,
-George