rename internal symbols contained in 56800ex library

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

rename internal symbols contained in 56800ex library

跳至解决方案
1,015 次查看
nxf49874
NXP Employee
NXP Employee

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.

0 项奖励
1 解答
943 次查看
nxf49874
NXP Employee
NXP Employee

I found that llvm toolchain could support DSC platform very well. So we could close this ticket. Thank you.

在原帖中查看解决方案

0 项奖励
6 回复数
944 次查看
nxf49874
NXP Employee
NXP Employee

I found that llvm toolchain could support DSC platform very well. So we could close this ticket. Thank you.

0 项奖励
894 次查看
Lorenzo_Mch_IT
Contributor IV

Question: "support DSC platform very well" as "LLVM toolchain's ELF utilities also support DSC" or as "Clang can target DSC" ?

0 项奖励
885 次查看
nxf49874
NXP Employee
NXP Employee

Yes llvm ELF tool can support DSC platforms very well.

0 项奖励
984 次查看
Lorenzo_Mch_IT
Contributor IV

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.

0 项奖励
974 次查看
nxf49874
NXP Employee
NXP Employee

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.

nxf49874_0-1710379336627.png

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:

nxf49874_1-1710379519321.png

In summary, objcopy needs to know the ELF target format even just for renaming symbol.

 

 

0 项奖励
952 次查看
Lorenzo_Mch_IT
Contributor IV

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).

0 项奖励