Hi DSC exports,
I'm working with CodeWorrior, whoes version information is below:
Installed Products:
- CodeWarrior for MCU
Version: 11.1
Build Id:181224
I'm using this tool to build a library and I need to rename the symbols in library to hide some technical details.
For ARM platform, I always use arm-none-eabi-objcopy to rename the symbols in library, such as:
arm-none-eabi-objcopy --redefine-sym security-check=func11 my.lib
I'm not sure if CW IDE contains similar tool to rename symbol name. If not, Do you have any suggestion or solution about this requirement.
Thanks in advance.
已解决! 转到解答。
Codewarrior for MCU uses .ar file format for libraries and ELF file format for .o and .elf files.
IIRC any recent version of objcopy can be used to rename symbols as you do with ARM libraries.
Since it is just symbol modifications, it's very likely that even your build for arm ( arm-none-eabi-objcopy ) can be used for that.
First sight, I have same thought with you, but practice told me I'm wrong.
1. I tried to run `arm-none-eabi-objcopy.exe -F elf32-little --redefine-sym Faeai_model_init=F11 aeai.lib
` to rename one symbol.
Note: In above command line, I have to specify the target to elf32-little, otherwise objcopy will report error.
2. Then I found objcopy file can rename the symbol correctly, but also it updated the ELF file header.
The original library machine information is: Freescale 56800EX Digital Signal Controller (DSC)
3. After I changed the machine value back by manual, I still met linker error:
In summary, objcopy needs to know the ELF target format even just for renaming symbol.
There is a last option if no other elf file utilities can do the job:
If you find acceptable to rename the symbols using another name having the same size, an option is using a binary editor and do a search & replace of the (NUL-terminated in the symbol string table of the .o files).