How to create symbol table using gcc
This is the correct answer from arm gnu launchpad:
Are you intending to download a symdef file using the GNU toolchain or with armcc? If the former, I think using nm in the object file and then linking with -R <filename>
will work. This way you do arm-none-eabi-nm -D ./prog > ./prog.defsym
after linking prog and then arm-none-eabi-gcc -Wl,-R,./prog.defsym
when you want to use it.
source to share
The GNU objcopy utility has an option --extract-symbol
that can do what you want. It generates an object file with only character data - no actual code or data.
It is specifically designed to create a .sym file for use in the VxWorks RTOS, which has a command shell and a dynamic linker / loader that uses this information. It is also used by the VxWorks host wrapper and source-level debugger.
binutils nm , on the other hand, generates output very similar to armlink --symdefs
, which you can easily execute exactly in the form you need.
source to share