rename internal symbols contained in 56800ex library

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

rename internal symbols contained in 56800ex library

Jump to solution
1,816 Views
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 Kudos
Reply
1 Solution
1,744 Views
nxf49874
NXP Employee
NXP Employee

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

View solution in original post

0 Kudos
Reply
6 Replies
1,745 Views
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 Kudos
Reply
1,695 Views
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 Kudos
Reply
1,686 Views
nxf49874
NXP Employee
NXP Employee

Yes llvm ELF tool can support DSC platforms very well.

0 Kudos
Reply
1,785 Views
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 Kudos
Reply
1,775 Views
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 Kudos
Reply
1,753 Views
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 Kudos
Reply