This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Building symbol table


I'm looking for a better way to build my symbol table.

I'm running an embedded (vxworks-alike) OS and I currently use objcopy -O binary to dump the text/data sections and push them to the board.

Currently my symbol table is built like this:
1) I have partially linked my executable
2) dump symbols with nm
3) parse the nm output with a script to build a new C file with basically a ["symbol_name_string", symbol_name] table.
4) link the compiled symbol table C file with the partially linked executable from 1) and let the linker resolve the addresses.
This is very time consuming and I would like to get rid of the double link.

I was exploring different ideas:
a) include the .symtab/etc sections in my data segment and use a linker script to PROVIDE() pointers to the beginning/end of the tables.
This didn't work.

b) Make a binary dump of the .shstrtab/.symtab/.strtab sections of my ELF executable and push that binary data to my board in a similar way as my text/data segments.

I was hoping that objcopy -j .strtab -j .symtab <in> <out> -O binary would get my that. Similarly readelf -x .strtab <file> works, but that is not the output format I want.

Ideally I prefer to get option 1) working, alternatively option 2). Are there any other options available? Or is the "double-link" still the best way to do it?

Maybe (?) the DWARF unwind tables contain similar information, but I'm using SJLJ exception handling so I can't easily switch. If that is a better solution, then maybe I can make the switch.

Thanks for your feedback.

- Jan

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]